|
A generic thunk is for 16 bits apps calling 32 apps and not the opposite .
Win95/98 supports flat thunks that permits a 32 app call a 16 bits app, this is what you want, I presume ?
Win NT/2000 doesn't not support Flat Thunks at all, so you must devise your form of IPC(Interprocess Communication Mecanism) . For instance doing your stub dll between the 16 bits dll and your code.
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
See this article on MSJ
Nerditorium
It explains that the _stdcall aka PASCAL convention used causes some funky code to be used , since with _stdcall , the calle must clean the stack , not the caller when using _cdecl call convention.
HTH
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Thanks Joao, looks like I've been barking up the wrong tree all afternoon, time to start reading the correct artices!
Regards,
Kevin.
|
|
|
|
|
Hi People, so near yet so far.......
Can anyone help me further with this?
I compiled my .ASM modules for the 16Bit DLL, hunted around until I found my MASM disks, compiled the .OBJ, created a 32Bit DLL Stub but now I'm stuck on the linking. Below is the output from the compiler, I assume this has something to do with name mangeling? - Any suggestions?
--------------------Configuration: ThunkDLL2 - Win32 Debug--------------------
Linking...
thk32.obj : warning LNK4033: converting object format from OMF to COFF
ThunkDLL2.obj : error LNK2001: unresolved external symbol "int __stdcall pack_ThunkConnect32(char *,char *,void *,unsigned long)" (?pack_ThunkConnect32@@YGHPAD0PAXK@Z)
Debug/ThunkDLL2.dll : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
ThunkDLL2.dll - 2 error(s), 1 warning(s)
|
|
|
|
|
_stdcall mangles names , so normally prefixes a underscore to the functions adds a @ and puts in the name the total bytes of the arguments , and something more e.g :
pack_ThunkConnect32 function uses 4 arguments , so it uses 16 bytes(?) so the calle knows the amount of memory that must pop from stack to clean it .
A fast way to see the name is using quickview utility that comes with windows , and view the mangled name on the exports table ?
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
If you used also c++ to do your dll you didn't forgot Extern "C" { ?
And here is the sample code to call stdcall ...
Assembly samples
Cheers,
Joao Vaz
A person who is nice to you, but rude to the waiter, is not a nice person - Natalie Portman (Padme/Amidala of Star Wars)
|
|
|
|
|
Hello,
I have a list view type MDI, I also have a MM Timer with in the CMainFrame. I am trying to assign a pointer to my list control from CMainFrame to get the number of items in the list control (inside the MM timer function). When I run the following code it crashes my app..
int count;
CListView* pList = (CListView*)(MDIGetActive()->GetActiveView());
count = pList->GetListCtrl().GetItemCount();
Is there a better way to get a pointer to CListView that wont crash my app?
|
|
|
|
|
Never mind.. I just moved the MM Timer to my CListView derived class and everything is working fine.. tnx anyways
|
|
|
|
|
hi,
how exactly is an ascii code converted into a character on the VDU?
If it is hardware embedded then how are japanese and chinese characters displayed even in dos?
-very curious
|
|
|
|
|
It is not hardware embedded. VDUs are raster-based, much the same as your TV: the OS basically draws the characters according to the font selected.
In the old days, so called ASCII terminals did the presentation internally --in those situations one could have problems displaying foreign characters.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a CPropertySheet which has two property pages in Wizard mode. In my OnWizardFinish handler on the second page I do an EndDialog(IDOK). I then call another modal dialog, dialogB. The wizard dialog does not go away until dialogB is dismissed and the return from the OnWizardFinish is executed.
- Is there anyway to make the wizard dialog go away immediatly, the EndDialog does not seem to do it?
- I've unchecked the System Menu resource from the wizard dialog. The CPropertySheet puts the system close button (X) in the upper right corner. Is there a way to remove it?
Thanks in advance,
Bob
|
|
|
|
|
As for your first question, probably calling CMyPropertySheet::ShowWindow(SW_HIDE) before launching the second dialog will do.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your response. This has no effect, the dialog is still behind the latest one, as it was before.
|
|
|
|
|
You sure? Try this sequence:ShowWindow(SW_HIDE) , launch dialog, EndDialog .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Are you calling ShowWindow( SW_HIDE ) directly from within the OnWizardFinish() handler, or are you calling GetParent() -> ShowWindow( SW_HIDE ) ?
As for the system menu, you can try specifying WS_POPUP without WS_SYSMENU when you create the Property Sheet, or modifying the Sheet's styles after creation.
Unchecking the System Menu in the Dialog/Resource Editor does little for you in this case, because the dialog editor is used to modify the Pages, not the Sheet.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
James,
The GetParent()->ShowWindow(SW_HIDE) does the trick, thanks.
How would I modify the Sheet's style after creation to have WS_POPUP without WS_SYSMENU? I assume I would do it in it's OnInitDialog()?
Thanks,
Bob
|
|
|
|
|
I've got it, it's ModifyStyle (WS_SYSMENU, 0) in the Sheet's OnInitDialog.
Thanks for your help.
Bob
|
|
|
|
|
why not just have whatever called the CPropertySheet call the dialog whenever it returns?
if (MySheet.DoModal() == ID_WIZFINISH)
{
dialogB.doModal();
}
if you have a good reason then ignore my question
-dz
|
|
|
|
|
Since i'm new here i don't really know if you use to check old topics... if not, check this one and help me please:
http://www.codeproject.com/script/comments/forums.asp?msg=180313&forumid=1647&kw=phoenix#xx179201xx
Stay cool :p
Phoenix
|
|
|
|
|
I have a worker thread that is carelessly updating the status bar. It's causing a GPF. This involves a large complex application framework, which isn't easily changed. I would like to change my MFC status bar code to be thread safe. Is there a way to do this? Would this work: Have the status bar store a HWND, and whenever accessed, construct a CStatusBar FromHandle?
|
|
|
|
|
Create a user defined message and make the thread post it from time to time to the main application thread (i.e the one that owns CMainFrame). Then all the updated will be done by the thread that owns the status bar.
In that message you will send the completion percent (10%, 20%). Read this article by Joseph M. NewCommer: Using Worker Threads
Best regards,
Alexandru Savescu
|
|
|
|
|
Is there an easy way to determine if I'm in a worker thread vs the main thread? I tried calling:
if( AfxGetMainWnd() )
expecting that it would return NULL if it was the worker thread, based on an article by NewComer on CodeProject. However, it didn't return null in the worker thread. Any ideas?
|
|
|
|
|
hi
when i tried to declare an object that take CString constructor as follow:
Group groupA("France", "Senegal", "Uruguay", "Denmark");
it just give me this error:
: error C2059: syntax error : 'string'
and this is my constructor implementation:
Group::Group(CString t1,CString t2, CString t3, CString t4)
{
team.Add(t1);
team.Add(t2);
team.Add(t3);
team.Add(t4);
}
and i've tried this one also and by the way what is LPCTSTR??
Group::Group(LPCTSTR t1, LPCTSTR t2, LPCTSTR t3, LPCTSTR t4)
{
team.Add(t1);
team.Add(t2);
team.Add(t3);
team.Add(t4);
}
What is going on??? Thanks heap for you help
|
|
|
|
|
Hm, maybe there's a problem with the team member variable. How it is defined?
A LPCTSTR is a const pointer to an ASCIIZ string. If it's really ASCII/ANSI or Unicode depends on your compiler settings.
Martin
|
|
|
|
|
looks like you're using a type called "string" somewhere, but you haven't #include'd the appropriate header.
where does the syntax error occur??
LPCTSTR is a pointer to an array of TCHARs. a TCHAR is some character type (char, wchar, etc) depending on your build settings.
-c
"Should you not have a ramekin of sea salt beside the stove, you don’t deserve oatmeal."
Dean Allen
|
|
|
|