?
Solved

wlxDialogBox Help!

Posted on 2003-03-12
15
Medium Priority
?
550 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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

Industry Leaders: 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!

Question has a verified solution.

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

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
Suggested Courses
Course of the Month8 days, 12 hours left to enroll

764 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