|
Basically you've to handle the WM_HELP message. When you press F1 the WM_HELP message will be posted to your window.
Since you are using mfc, handling it in MFC way will be more easier. Add ON_WM_HELPINFO() to message map and add implement OnHelpInfo() in your dialog. For instance,
BEGIN_MESSAGE_MAP(CYourDialog, CDialog)
...
ON_WM_HELPINFO()
END_MESSAGE_MAP()
BOOL CYourDialog::OnHelpInfo( HELPINFO* HelpInfo)
{
return TRUE;
}
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi,
Could anyone please tell me the maximum size of data that can be copied to clipboard?
Thanks,
Divya
|
|
|
|
|
I have a project on VC++ 6.0, the exe file generated out of that was 5 MB,But after conversion to VS2005 it's now 16 MB.what may be the reason? Any thing else is required to reduce the file size.
Regards,
KDevloper
|
|
|
|
|
|
Hey jijo,
I have already followed the way it's there in your blog, But no it's not helping.. any other idea.
Thanks&Regards,
KDevloper
|
|
|
|
|
"disable Incremental Linking" doesn't make any difference? I hope you've cleaned and rebuild your project. I've tried it in a sample visual studio 2005 project and i can see good result. Please check once again!
Well, the MFC libraries are statically linked? that can increase your exe size.
kDevloper wrote: I have already followed the way it's there in your blog, But no it's not helping.. any other idea.
Oooh! You already read that one?
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Yes, am cleaning and rebuilding this 500 bunch of files from last evening.. but i guess the "disable Incremental Linking" and code generation property change helped me to gte out of the problem.. ok thanks.
U r posts in the blog is really useful.
Regards,
KDevloper.
|
|
|
|
|
kDevloper wrote: U r posts in the blog is really useful.
Thanks a lot for those kind words.
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
|
ok.. will check it out.
Thanks &Regards,
KDevloper
|
|
|
|
|
I am new to VC++ programming and have coded for the first time trying to understand Windows messaging. (I am more used to the good old days of Borland's Turbo C++ 3.0)
My question is about structures.. In the snippet below I have defined my structure as such.
In this snippet I have declared the structure in the Window Process DlgProc as static TONE tsTone; which now works for me!! I previously had it declared as just TONE tsTone; .
If I do not declare the structure as static, after populating the members in the IDC_ONOFF: message when the Windows Process is called again, the structure reference in MM_WOM_OPEN: message has rubbish member values and has a different reference address.
My question is - given the struct of TONE tsTone; is declared within the scope of DlgProc why does the structure appear to be volatile and given a new reference address when a different Windows message is processed? If I am using variables that are spread throughout Windows Messages (but still within the scope of the WinProc), should all variables be declared static?
P.S. some reading reference would be very handy if you have it so you don't have to re-invent the wheel.
Aaron.
typedef struct {
int itoneEncoding;
double dtoneLeadin;
double dtoneLength;
int iBuffersize;
}TONE, * PTONE;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
<<SNIP>>
}
BOOL FillBuffer (PBYTE pBuffer, TCHAR * pszToneCode, PTONE tsTone)
{
int iBuffer;
<< SNIP >>
iBuffer = tsTone->iBuffersize;
for(icTone = 0; icTone < 5; icTone++)
{
<< SNIP >>
else
return FALSE;
<< SNIP >>
return TRUE;
}
BOOL CALLBACK DlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
<<SNIP >>
static TONE tsTone;
switch (message)
{
<< SNIP >>
case IDC_ONOFF:
tsTone.itoneEncoding = iEncoding;
tsTone.dtoneLeadin = GetDlgItemInt(hwnd, IDC_EDIT_LEADIN, NULL ,FALSE);
tsTone.dtoneLength = GetDlgItemInt(hwnd, IDC_EDIT_TONELENGTH, NULL ,FALSE);
tsTone.iBuffersize = (int)(SAMPLE_RATE * (tsTone.dtoneLength/1000)*5);
<<SNIP>>
case MM_WOM_OPEN:
SetDlgItemText (hwnd, IDC_ONOFF, TEXT ("Turn Off")) ;
GetDlgItemText (hwnd, IDC_TONECODE, szToneCode, 6) ;
if(!FillBuffer (pBuffer1, szToneCode, &tsTone))
<<SNIP>>
case MM_WOM_DONE:
<<SNIP>>
case WM_SYSCOMMAND:
switch (wParam)
<<SNIP>>
return TRUE ;
}
break ;
}
return FALSE ;
}
|
|
|
|
|
Aaron.Morrison wrote: In this snippet I have declared the structure in the Window Process DlgProc as static TONE tsTone; which now works for me!! I previously had it declared as just TONE tsTone;.
While declaring your structure as TONE tsTone; the structure will be allocated on stack. Since stack will be recreated at different locations during each function call, Local variables on stack are not Persistent between function calls. And local variables will be deleted when the function returns.
if you declare the stack variable as static, it will be initialized during the first call to that function and persists between function calls. They won't be deleted when function returns. For more info, read this - http://www.cprogramming.com/tutorial/statickeyword.html[^]
Aaron.Morrison wrote: should all variables be declared static?
Other possible ways are -
1) You can keep your structure as global.
2) You can create a singleton class to keep the Persistent data and use it (Recommended).
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Thanks for pointing out the obvious !!!!
I forget to realise that the function returns after every message completes processing.
Aaron
|
|
|
|
|
Hello
Newcomer here.
If I am developing application in C# in Visual Studio 2008, I have to install dot net framework in the target system before installing my application. OK?
Can I create a application using Visual C++ in visual studio 2008 which will run without dot net framework in the target system?
May be a silly question, Sorry I was not able to get an answer before.
Thanks
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
CelestialCoder wrote: Can I create a application using Visual C++ in visual studio 2008 which will run without dot net framework in the target system?
Yes, of course! Visual Studio is an IDE which supports multiple languages.
Best Wishes.
-David Delaune
|
|
|
|
|
Hello
Thanks for the reply. But one more clarification.
I understood that VisualStudio supports many languages like C++, VB etc in VS2008.
But my confusion is regarding the target requirement. Suppose I develop a application in VisualC++ using VS2008 (Windows forms application),will it asks for dot net framework while it is deployed in another system?
Thanks for the patience.
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
CelestialCoder wrote: Suppose I develop a application in VisualC++ using VS2008 (Windows forms application),will it asks for dot net framework while it is deployed in another system?
Windows Forms is a part of the .NET framework and has nothing to do with Visual C++. So, if you develop a Windows Forms application, it will require the .NET framework to be installed on the computer where it would be deployed.
|
|
|
|
|
Rajesh R Subramanian wrote: Windows Forms is a part of the .NET framework and has nothing to do with Visual C++.
Then what was the windows applications created in VisualC++ using VisualStudio 6 (Prior to dot net) called?
Thanks for the time
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
CelestialCoder wrote: [Frown] Then what was the windows applications created in VisualC++ using VisualStudio 6 (Prior to dot net) called?
Native application?
But I see where you ask that question from. I need to mention you that if you write a Visual C++ application with the latest version of Visual Studio, that still would be a native application.
I'd tell you again: Windows forms is not a part of C++. It is a part of the .NET framework. You are just confusing .NET with C++. They are two different things.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Rajesh R Subramanian wrote: if you write a Visual C++ application with the latest version of Visual Studio, that still would be a native application.
then How to create a native application (with a GUI like that we get initially in VS6) in VS2008 is my only issue.
Thanks a lot for the time.
I think we are close to solve the issue..
I opened VS2008 - selected VisualC++ as language-
Now to get a GUI I should select Windows forms application.. Wrong.. So go back..
But I cant find a place to start a native application. I know you are not suggesting that way. But how?
Then How to create a simple GUI with a simple text box and button (Like that we see in SAMs 24 Hr books 1st lesson) which can run in WinXP with no dotnet framework?
Thanks again
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
CelestialCoder wrote: But I cant find a place to start a native application. I know you are not suggesting that way. But how?
Open VS 2008, select Visual C++ as the language, and then select, for example:
MFC Application - An application that makes use of MFC libraries. This will require the MFC dlls to be present in the client machine. (You can do a little test with a dialog based application). This wouldn't require the .NET framework to run.
There's also win32 console application, MFC DLLs, Win32 project, etc., They all, each, solve a specific purpose.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
modified on Wednesday, August 13, 2008 6:37 AM
|
|
|
|
|
Hello
Thanks a lot. issue clear Now.
I choose MFC and selected dialogue based- appeared the form I was looking for. (Didn't checked with deployment, but I am sure it will be ok.
Thanks a lot for solving my confusion. Also for your valuable time.
With Regards
Roy Thomas
"..this file is known as source file probably because it is a source of frustration and anxiety!" - Chuck Sphar - In book 'C# 2005 for Dummies'.
|
|
|
|
|
CelestialCoder wrote: Thanks a lot for solving my confusion. Also for your valuable time.
My pleasure.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
May be this article will solve your confusion..
Windows Forms.[^]
Very first line of the article says this:
Windows Forms is the name given to the graphical user interface application programming interface (API) included as a part of Microsoft's .NET Framework, providing access to the native Microsoft Windows interface elements by wrapping the existing Windows API in managed code. While it is seen as a replacement for the earlier and more complex C++ based Microsoft Foundation Class Library,
Regards,
Sandip.
|
|
|
|
|
Hi all,
What does this mean?
1>PrefDlg.obj : error LNK2019: unresolved external symbol "protected: char * __thiscall CPrefDlg::EventTypeString(unsigned short)" (?EventTypeString@CPrefDlg@@IAEPADG@Z) referenced in function "protected: int __thiscall CPrefDlg::CreateEventLogEntryFile(int)" (?CreateEventLogEntryFile@CPrefDlg@@IAEHH@Z)
1>D:\SVN\Licensin System\Work Package\UpdateManager\Debug\UpdatePanel.cpl : fatal error LNK1120: 1 unresolved externals
I have linked the right headers here.
thanks,
Jayjay
|
|
|
|