Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

wlxDialogBox Help!

Posted on 2003-03-12
15
Medium Priority
?
556 Views
Last Modified: 2008-03-04
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.
0
Comment
Question by:dave_p_r_b
  • 8
  • 6
15 Comments
 
LVL 46

Expert Comment

by:Kent Olsen
ID: 8120330

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
0
 
LVL 86

Expert Comment

by:jkr
ID: 8120656
>>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);

0
 

Author Comment

by:dave_p_r_b
ID: 8120799
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.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:dave_p_r_b
ID: 8120810
...
could the LPTSTR cast be causing strife? I'm in unicode.
0
 

Author Comment

by:dave_p_r_b
ID: 8120850
...
could the LPTSTR cast be causing strife? I'm in unicode.
0
 
LVL 86

Expert Comment

by:jkr
ID: 8120918
>>"The specified image file did not contain a resource section."

Are you sure you do have resources in that DLL?
0
 

Author Comment

by:dave_p_r_b
ID: 8120995
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.
0
 
LVL 86

Expert Comment

by:jkr
ID: 8121083
Could you post the dialog section in the .rc file?
0
 

Author Comment

by:dave_p_r_b
ID: 8121124
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.
0
 

Author Comment

by:dave_p_r_b
ID: 8121156
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.
0
 
LVL 86

Accepted Solution

by:
jkr earned 500 total points
ID: 8121157
Aaah - as You are using MFC, try

HMODULE hMod = LoadLibrary( GINASTUB_DLL_PATH );

AfxSetResourceHandle ( hMod);

0
 

Author Comment

by:dave_p_r_b
ID: 8126450
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.
0
 
LVL 86

Expert Comment

by:jkr
ID: 8141024
Hmm, thanks, but why a "C"?

(Have you changed the registry entries for your new project? :o)
0
 

Author Comment

by:dave_p_r_b
ID: 8141953
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.
0
 
LVL 86

Expert Comment

by:jkr
ID: 8145233
then again, why a "C"??
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question