|
Seems like you're mixing code using single-threaded and multi-threaded CRT. FILEX is just FILE in single-threaded CRT. In MT version, FILEX aggregates FILE with critical section.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Thats a bit weird.
I had another look at my settings and changed from Static Linkage to Dynamic Linkage, In statis linkage it was using the Debug Multithreaded Archive and having the problems and in the dynamic linked build its using the Dynamic Multithreaded DLL and now it works?
Is this an issue with the Archive vs the DLL ? As I would really like to finaly make a static build and stop with all the installation problems i have.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Jawache wrote:
Is this an issue with the Archive vs the DLL
I'm not sure what are you talking about here. By 'archive' you mean 'static library' or something else?
Your app is single .exe, or you have .exe and your own .dlls? Are you using 3rd party libraries?
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Yeah i think i know whats going on now.
Yes i am using a third party library thats been dynamicaly linked and i had my application statically linked. So the object code to create the FILE object was staticaly linked in my app. Whereas the code to access the FILE object was in the shared DLL version of the library.
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
Hi,
We have an application which connects to a database across a network and
want to prevent machines from hibernating.
We can catch the WM_POWERBROADCAST message and check for the PBT_APMQUERYSUSPEND message in the WParam and display a message. So something like this:-
ON_MESSAGE( WM_POWERBROADCAST, OnHibernate )
LRESULT CMainFrame::OnHibernate(WPARAM WParam, LPARAM LParam)
{
if( WParam == PBT_APMQUERYSUSPEND )
{
AfxMessageBox( _T("About to hibrenate or standby!"), MB_OK );
return BROADCAST_QUERY_DENY ;
}
return WParam;
}
The first time we run the app and select hibernate or suspend it is fine and the message pops up correctly however thereafter the screen goes greyed as usualy on a shutdown and the message is not displayed until I give my application focus. Obviously there is something else I need to do to handle the message.
Any suggestions?
Thanks
Dave
|
|
|
|
|
From MSDN docs on PBT_APMQUERYSUSPEND:
lParam: A DWORD value that specifies action flags. If bit 0 is 1, the application can prompt the user for directions on how to prepare for the suspension; otherwise, the application must prepare without user interaction. All other bit values are reserved
...
The system allows approximately 20 seconds for an application to remove the WM_POWERBROADCAST message that is sending the PBT_APMQUERYSUSPEND event from the application's message queue. If an application does not remove the message from its queue in less then 20 seconds, the system will assume that the application is in a non-responsive state, and that the application agrees to the sleep request
Maybe you should check this lParam bit?
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Thanks,
I had tried checking that bit and only displaying the message then but made no difference.
But now have found the problem is due to showing the warning message box as part of the message handler. If I process the message first and return BROADCAST_QUERY_DENY and then display my message box it all works fine
Dave
|
|
|
|
|
Dave Merrifield wrote:
If I process the message first and return BROADCAST_QUERY_DENY and then display my message box it all works fine
It makes perfect sense, since you have only 20 seconds to process the message. If user doesn't close the msgbox quite fast, Windows will ignore returned value.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Yep does make sense now it was when you reminded me of the 20 second time limit it occured to me.
Thanks for your help Tomasz.
Dave
|
|
|
|
|
I've spotted this in one of the files I'm maintaining:
#ifdef AFX_COLL_SEG
#pragma code_seg(AFX_COLL_SEG)
#endif A quick look on MSDN tells me that the code_seg part "specifies a code section where functions are to be allocated". What does that actually mean, what's happening here? MSDN also says I can reset allocation with #pragma code_seg() - do I need to do this, as it's not allready done?
Dylan Kenneally
London, UK
|
|
|
|
|
Comments in MFC source (afxver_.h) suggest that this is 'swap tuning'. Using code_seg changes the ordering of the functions in resulting executable; by placing commonly used functions together you may get some performance boost.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Read up on the PE format (knowing MS COFF a bit couldn't hurt either).
What it in practice means is that for a "normal" program your code is located in the PE section ".text", and this pragma changes it to something else.
|
|
|
|
|
I want to create an auto-complete edit control. The text that user keydown and the text that automatically appear at end have difference color.
How can I override CEdit to print characters in difference color in the same edit control?
|
|
|
|
|
sonshiro wrote:
The text that user keydown and the text that automatically appear at end have difference color.
Usually auto-complete control just selects the completed part - user will see background and text colors reversed.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
I don't want to do that way. I want the completed part be shown with difference text color but have same background color.
|
|
|
|
|
Hi !
For my app, I need to display a virtual keyboard on screen. This virtual keyboard will be used through a touch screen. I have to follow specific norms, and the size of the keys have to be at least 1 centimeters wide.
I also would like to be able to show and hide this keyboard from my app.
I tried to find such keyboard on the internet, but didn't find something which would fullfill my needs (in particular regarding the size of the keys). Do you know of any virtual keyboard which would be suitable for me ?
I also was thinking of developping my own virtual keyboard, in VB or in C++, as an ActiveX, but I'm facing some problems : as soon as I click on a key, this key get the focus and thus, sending a keystroke to the control having the focus is actually sending a keystrock to the virtual keyboard !
Any suggestions to help me get started ?
Thank you for your help !
Jerome
|
|
|
|
|
What about using the one built in into Windows? Should do the trick. Just install the accessibility features.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
I tried it, but the problem, that I mentionned in my post, is that the keys are far too small for my needs !
I also wouldn't know how to control it from my app to display it and to close it when I want.
Thanks anyway !
Jerome
|
|
|
|
|
Look at http://www.madentec.com/[^] the original creator of the windows virtual keyboard.
But if you go for a roll-your-own solution, start with not processing the activation and focus messages. Just use mouse events. Its a bit tricky but not too difficult to do.
int x=1, y=5;
x^=y^=x^=y;
<a href="http://www.codeproject.com/tips/StupidXORTrick.asp" target="_blank">ClickHereForHelp();</a>
|
|
|
|
|
Hi all,
I have added a tool tip control to my dialog.How can i get the tool tip text in a string when mouse is over a cotol?
With regards
shibu
|
|
|
|
|
Your dialog will get TTN_NEEDTEXT notification.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Can you tell me how can i handle this in a dialog based application?
|
|
|
|
|
Have a look at DLGCBR32 Visual C++ sample.
Tomasz Sowinski -- http://www.shooltz.com
** Putt knot yore thrust inn spel chequers. **
|
|
|
|
|
Hi
Does anyone know how can I install a printer driver from VC++ code ?
And how can I set the driver to print always to a file not to a real printer?
Please help if you can (also if you have the answer for only 1 question)
Thanks a lot
Jancsi
xxx
|
|
|
|
|
There's a system API called AddPrinterDriver , seems like a promising starting point.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|