Link to home
Start Free TrialLog in
Avatar of dave_p_r_b
dave_p_r_b

asked on

wlxDialogBox Help!

I'm trying to display a dialog box using the wlxDialogBox function. However, despite several attempts, I am unable to get the function to return anythng other than -1 - i.e. it fails. Please note I am very new to this library of functions and their use.
 
I have the hWndOwner and dlgprc parameters as NULL. is this allowed?
   
I'm calling the wlxDialogBox function if the GWlxLoggedOutSAS returns WLX_SAS_ACTION_LOGON. (I'm modifying the ginastub sample)

code snippet:
int res = pWlxFuncs->WlxDialogBox( hGlobalWlx, hDllInstance, (LPTSTR)MAKEINTRESOURCE(IDD_OS_CHOICE_DLG), NULL, NULL);
 

I created the dialog using the resource editor. I'm using the MAKEINTRESOURCE macro to convert my resource ID.
hGlobalWlx is taken from wlxInitialize.
hDllInstance is taken from DLLmain function.
 
I'm kinda desperate!
Regards,
d.
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image


Depending upon where the function lies is in your code it could be just as simple as "this".  ;)

Generally, Windows and Forms are owned by the process that instantiates them.  You're trying to open a Dialog Box from the running process so you probably want the current process to own the Dialog Box.

Try using "this" for hWndOwner.


Kdo
>>I have the hWndOwner and dlgprc parameters as NULL. is this allowed?

NULL for 'hWndOwner' should be OK (as for all dialog boxes), but DlgProc must not be NULL - specify 'DefDlgProc()' (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/dialogboxes/dialogboxreference/dialogboxfunctions/defdlgproc.asp) instead, e.g.

int res = pWlxFuncs->WlxDialogBox( hGlobalWlx, hDllInstance, (LPTSTR)MAKEINTRESOURCE(IDD_OS_CHOICE_DLG), NULL, DefDlgProc);

Avatar of dave_p_r_b
dave_p_r_b

ASKER

Hi,
I implemented a callback fnction, but this seemed to have no effect.

In desparation I called GetLastError  (ok, it's a stab iin the dark given that its not in the help for wlxdialogbox) .. it gave
error :

"The specified image file did not contain a resource section."

....
could this be related?
Thanks for you help.....
d.
...
could the LPTSTR cast be causing strife? I'm in unicode.
...
could the LPTSTR cast be causing strife? I'm in unicode.
>>"The specified image file did not contain a resource section."

Are you sure you do have resources in that DLL?
I created a dialog using the resource editor... as i usually would in, say, a regular MFC program.

I'm trying to write a program to load the DLL and then load the resource.... I apprear to be unable to do that too :( .
HMODULE hMod = LoadLibrary( GINASTUB_DLL_PATH );

HRSRC   hRes = FindResource( hMod, MAKEINTRESOURC(101) , RT_DIALOG );

if(hRes == NULL )
AfxMessageBox("hRes == NULL");


///I happen to know my resource ID was #defined as 101 in resource.h

the AfxMessagebox always appears :S

D.
Could you post the dialog section in the .rc file?
I created a dialog using the resource editor... as i usually would in, say, a regular MFC program.

I'm trying to write a program to load the DLL and then load the resource.... I apprear to be unable to do that too :( .
HMODULE hMod = LoadLibrary( GINASTUB_DLL_PATH );

HRSRC   hRes = FindResource( hMod, MAKEINTRESOURC(101) , RT_DIALOG );

if(hRes == NULL )
AfxMessageBox("hRes == NULL");


///I happen to know my resource ID was #defined as 101 in resource.h

the AfxMessagebox always appears :S

D.
I created a dialog using the resource editor... as i usually would in, say, a regular MFC program.

I'm trying to write a program to load the DLL and then load the resource.... I apprear to be unable to do that too :( .
HMODULE hMod = LoadLibrary( GINASTUB_DLL_PATH );

HRSRC   hRes = FindResource( hMod, MAKEINTRESOURC(101) , RT_DIALOG );

if(hRes == NULL )
AfxMessageBox("hRes == NULL");


///I happen to know my resource ID was #defined as 101 in resource.h

the AfxMessagebox always appears :S

D.
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ok,

Was only using MFC in a test project to discover problem with my DLL.

Late last night I imported all the files into a new project, seems to have found the resource this time.  :)

Unfortunately, now I get the "someone has screwed your GINA - get your system administrator to bail you out" message on start up. Well, words to that effect.

Ideas? <begging>
David.
Hmm, thanks, but why a "C"?

(Have you changed the registry entries for your new project? :o)
solved the problem by importing all my files into vc 6 ( I was using vc.net). Apparantly there was a problem with the exported fnctions in the .dll. I still dont know what the problem was in .net, but when i imported the working project from vc6 back into .net, it also imported the necessary settings.
All done and dusted, project complete, boss chuffed, job done. Totally confused.Cheers,
d.
then again, why a "C"??