|
when you stop mouse cursor on some icon, a yellow rectangle appears near the cursor containing help texts. how can I implement this, with API functions?
|
|
|
|
|
|
Ok. I know this is really basic, but why can't I find the constructor code to open my documents from a button control? (MFC) I must be using wrong search key words, because I can't find it here. Can any one point me in the right direction?
Thanks,
RRL
|
|
|
|
|
Try to use CDocTemlate class for this purposes, OpenDocumentFile member.
You must register DocTemplate first!
Another way is to use CWinApp::OpenDocumentFile or AfxGetApp()->OpenDocumentFile instead.
|
|
|
|
|
sveige wrote:
...why can't I find the constructor code to open my documents...
For your CDocument -derived class?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Using the class CLimitSingleInstance I have managed to enusure that only one instance of my application is active.
I would like to do one more enhancement.
Whenever there is an attempt to run multiple instance the current running instance should be restored to full view.
I think it has to be done in the InitInstance() of my appln.
Can anyone suggest the procedure.
laiju
|
|
|
|
|
Hi
if your instance is already running you should call showwindow() with maximise option.
Hope it works
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I had tried that option but the application crashes when I do that.
Given below is the implementation..
CLimitSingleInstance g_SingleInstanceObj(TEXT("{A79AAE6A-62E1-4c0e-B678-72F127AD4B03}"));
BOOL CKolOSDBuilderApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
if (g_SingleInstanceObj.IsAnotherInstanceRunning())
{
AfxMessageBox("An instance is already running");
return FALSE;
}
laiju
|
|
|
|
|
Hello,
You could post a message to the application that is already running and maximize the application from there.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
i tried using the variable theApp.m_pMainWnd to post a message ,but i think this doesnt have a valid pointer which crashes the application.
BOOL CKolOSDBuilderApp::InitInstance()
{
// InitCommonControls() is required on Windows XP if an application
// manifest specifies use of ComCtl32.dll version 6 or later to enable
// visual styles. Otherwise, any window creation will fail.
if (g_SingleInstanceObj.IsAnotherInstanceRunning())
{
theApp.m_pMainWnd->SendMessage(WM_CLOSE_PROJECT,0,0);
return FALSE;
}
laiju
|
|
|
|
|
Remember that you post the message to your own application. You'll have to find a way to obtain the process handle of the previous application.
You can always write a DLL that is shared among your applications and store various data there...
There are a lot of ways to solve your problem!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I sometimes use the following method to only run a single instance, I simply use FindWindow to look for the window's title.
Yes, I know if two programs have the same title this logic will fail, but that is 'unlikely'
if((hWnd = FindWindow(NULL, szTitle)) != NULL)<br />
{<br />
ShowWindow(hWnd, SW_RESTORE);<br />
SetForegroundWindow(hWnd);<br />
MessageBeep(MB_ICONEXCLAMATION);<br />
return(0);<br />
}<br />
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
It will also fail if the app is an MDI or SDI app that has the opened file name in the caption.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
http://www.codeproject.com/cpp/avoidmultinstance.asp[^]
laiju wrote:
Whenever there is an attempt to run multiple instance the current running instance should be restored to full view.
I used the technique described in Dr Newcomer's article to do just that in two of my articles, for an MFC example see here[^] and for a Win32 API example see here[^].
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
One way to do it is to create a mutex and an event in the application. The mutex is used to determine whether the application is already running or not. The event is used to signal the process which created it to show itself. All you need to do in the "single instance" process, is to listen to the event and respond to signals sent on it.
See CreateEvent(), SetEvent(), and ResetEvent() in the MSDN docs.
Good music: In my rosary[^]
|
|
|
|
|
laiju wrote:
Whenever there is an attempt to run multiple instance the current running instance should be restored to full view.
See here.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi,
Obviously u know the caption of your application..[I mean caption on the tittle bar of parent window]
use FindWindow API to search with that window caption...if FindWindow API succeeds u will get the handle for that..
then u send the window resize message with that handle otherwise go as normal...
try this in InitInstance...
With Regards
Prabhu.S
www.PraxUnited.com
|
|
|
|
|
Can anybody mail me the file jpeglib.h
aasstt
|
|
|
|
|
if you mean the one in the IJG's[^] source code, you can get it from the link...
- Indivara
"...This city desert makes you feel so cold.
It's got so many people but it's got no soul..."
- Gerry Rafferty, Baker Street
|
|
|
|
|
Hi all
Am familiar with serial port communication in VC++.
I have written a software for connecting a datalogger device into the serial port and reading the data from the device.
Now I want to make this device and software able to be connected to the USB port, since most the laptops have only USB.
Please help me regarding how I can start sending and recieving data via the USB port in windows.
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
If using a standard USB to serial convertor your code "should" work just fine using the COMx port installed by the driver (usually COM3 or higher), however the USB serial ports so not act quite the same as UART based serial ports, in particular they tend to appear "blockier" (data arrives in distinct blocks rather than in a more continual stream).
I have found that this can interfere with the expected action, particularly the timing of serial messages.
If you want to add the USB port to the actual datalogger hardware I suggest you look at something like the CP2102 (Silicon Laboratories). This is a very small IC that can easily be added to your product and converts from serial to USB (no crystal required which keeps the cost down).
|
|
|
|
|
Extreme caution is preserved when using those port converters. I've used some and all of them mananged to blue screen WindowsXP! I've never seen one of those since Windows 98.
The problem with those USB serial ports is that most of the drives implement CancelIO wrong and that causes a lot of trouble. More information about this can be found in the CSerial[^] article.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
After derived my view from CPreview, I have now a preview screen but, when i print from it or when i close this screen, the program broken down. what to do ?
I learn my self
|
|
|
|
|
mikobi wrote:
...the program broken down. what to do ?
Describe, in detail, what the problem is. Simply saying that it is broken is not very helpful.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
When I clic on the print button on the printpreview screen there is this message : this program will be stopped because it does an operation not permit. If this error continue, let contact your reseller.
I learn my self
|
|
|
|