|
Your toolbar is a member variable inside your CFrameWnd-derived class. Just delete the variable and all references to it, and it won't be there.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
clintsinger wrote:
How does one get rid of the toolbar?
Go to CMainFrame::OnCreate() and remove the line that creates the toolbar.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
I' have a little problem with keyboard input. For control input (shift, crtl, arrow,...) Virtual keys are defined and is use them in th OnKeyPressed function (like you see in de code).
If i press the shift button, is see the right messageBox, if i press the up arrow nothing happens. But if i hold the up-arrow down, and press another key i get a messagebox saying "up key pressed", so the problem is not that the virtual key is wrong, but that no KeyPressed event is fired when the up arrow is pressed. Why? And even more important, what to do about it?
Here's the code
void CKeyboardDlg::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if(::GetKeyState(VK_SHIFT) <0)
MessageBox("Shift pressed");
if(::GetKeyState(VK_UP)<0)
MessageBox("up arrow pressed");
...
}
|
|
|
|
|
There are various kbd messages you need to handle depending on what you want to process: WM_KEYDOWN/UP, WM_SYSKEYDOWN/UP, WM_CHAR, WM_SYSCHAR, WM_DEADCHAR, WM_SYSDEADCHAR.
This is all documented in the SDK Help!
UpArrow etc. are WM_SYSKEYxxx messages from memory.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Dialog boxes are notorious for stealing keypresses, such as Enter, Tab, or the arrow keys. Have a look at the WM_GETDLGCODE message, specifically at the DLGC_WANTALLARROWS flag. Your code is correct, you just need to handle WM_GETDLGCODE as well.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I was wondering how I get a key pressed that isn't handled by my CView derived class to be passed down to the CFrameWnd container that it is sitting in. I have a OnkeyDown in my CView class and one in my CFrameWnd class. When I fire a keydown event by typing on the keyboard, I only get the message as far as my CView class. What do I need to do so it propagates down to the CFrameWnd class?
Cheers,
Clint
|
|
|
|
|
Put this in your CView::OnKeyDown()
GetParent()->PostMessage(WM_KEYDOWN,nChar,MAKELONG(nRepCnt,nFlags));
John
|
|
|
|
|
Hi,
When a program have a Memory leak, do I get back the memory after the app close? Or is the memory lost until windows restart?
Thanks
Everything's beautiful if you look at it long enough...
|
|
|
|
|
MemLeak wrote:
do I get back the memory after the app close
In most cases you should.
John
|
|
|
|
|
Hi,
I was wondering how to changed the enabled/disabled state of a command button by using messages. Im not using MFC for this so I need to know the proper message to send to it and how to set up the data that goes with it (if it can be done this way).
Thanks in advance
Zak
|
|
|
|
|
One solution is SendMessage().
SendMessage(hButton, WM_ENABLE, static_cast<wparam>(/*TRUE or FALSE*/), 0);
Kuphryn
|
|
|
|
|
If you mean buttons on a dialogbox, you can do the following:
GetDlgItem(IDC_NAMEOFBUTTON)->EnableWindow(TRUE);
TRUE enables, FALSE disables (which is logic)
You cannaot only use this for buttons but for every kind of control (radio buttons, text fields,...
Zedd
|
|
|
|
|
Hi
I am developing a Windows GUI that interacts with two Unix servers.I aim to transfer files between these two servers.And I achieve this from Windows by using the 'rsh' command.I basically call a shell script remotely that will transfer the file from one server to the other.My problem is how I can be able to route any output from my script program in Unix back to my program in windows that can tell me whether I was succesful or whether the file already exists there??Isit possible to route the output of a SHELL script in Unix back to a windows conrol or store it in a string??I would eagerly like some help fast.
Thanks
Jesus Loves You
|
|
|
|
|
Please help - I am trying to get some control/window data from a GUI written in Delphi, from inside a Hook application I have written in C++. The problem is that I don't know how to get some of the data from these Delphi controls. I used pretty standard way to hook the GUI app, using:
SetWindowsHookEx(WH_CBT, (HOOKPROC)msghook, hInst, 0);
Within my hook processing function (msghook), I have:
case HCBT_ACTIVATE:
if(m_szModule[0] == '\0')
GetProcessName(m_szModule);
char szClassName[100];
GetClassName(hWnd, szClassName, sizeof(szClassName));
sprintf(buf, "MyHookApp::msghook - ProcessName [%s] ClassName [%s]", m_szModule, szClassName);
logFile.LogMessage(buf);
if ((0== stricmp(m_szModule, "GUIApp.exe")))
{ // logs all child windows
EnumChildWindows(hWnd, EnumChildProc, 0);
}
--------------------------------------------
// Call back function that will retrieve and log Window ID,
// Window Class Name, and the WindowText
BOOL CALLBACK EnumChildProc(HWND hwndChild, LPARAM lParam)
{
int idChild = GetWindowLong(hwndChild, GWL_ID);
char szText[100];
char szClassName[100];
char szBuf[1024];
::GetWindowText(hwndChild, szText, sizeof(szText));
GetClassName(hwndChild, szClassName, sizeof(szClassName));
sprintf(szBuf, "**** id:%02d, ClassName:%s, [%s]", idChild, szClassName, szText);
logFile.LogMessage(szBuf);
return TRUE;
}
--------------------------------------------
The problem is that the output revealed that all the controls of this GUI app do not have Text assosciated with them. GetWindowText returned empty strings.
07/03 06:05:16: **** id:262484, ClassName:TPanel, []
07/03 06:05:16: **** id:852418, ClassName:TListBox, []
07/03 06:05:16: **** id:197008, ClassName:THeaderControl, []
07/03 06:05:16: **** id:197176, ClassName:TSortGrid, []
07/03 06:05:16: **** id:197104, ClassName:TEdit, []
07/03 06:05:16: **** id:197084, ClassName:TPanel, []
07/03 06:05:16: **** id:197094, ClassName:TPanel, [3/07/03 6:04]
As you can see above, only one had any text associated with it. I know that all of these controls do have text. I also hooked the TextOutA and TextOutW API's to see what was being drawn on the screen. I will see things like:
07/03 06:05:16: W(0,0)Text on Control1
07/03 06:05:16: W(0,0)Text on Control2
07/03 06:05:16: W(0,0)Text on Control3
So, basically the string "Text on Control1" is the text that appears on the first TPanel from above (id:262484). Is there any way that I can query the TPanel/Window to find this information?
I really appreciate any help anyone can provide.
|
|
|
|
|
I'm getting the error message below. I'm working on an MFC project. I am using the DLL library. I have read the FAQ area of the forum. I tried to link to the msvcrtd library in settings/link, but it then said that the msvcrtd.obj was missing. Anybody? Where might the missing object be?
--------------------Configuration: Exodus - Win32 Debug--------------------
Linking...
LINK : fatal error LNK1104: cannot open file "msvcrtd.obj"
Error executing link.exe.
Exodus.exe - 1 error(s), 0 warning(s)
If I don't link to the msvcrtd library from settings/link, then I get the following 5 errors...so I must be getting closer to solving this...hopefully
--------------------Configuration: Exodus - Win32 Debug--------------------
Linking...
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusDoc::classCExodusDoc" (?classCExodusDoc@CExodusDoc@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CMainFrame::classCMainFrame" (?classCMainFrame@CMainFrame@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusView::classCExodusView" (?classCExodusView@CExodusView@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/Exodus.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Exodus.exe - 5 error(s), 0 warning(s)
Thanks
|
|
|
|
|
Try specifying msvcrtd.lib in your linker settings instead of msvcrtd. It looks like the linker is assuming that you mean .obj when you don't specify an extension.
[EDIT]
The first four errors are because you don't have IMPLEMENT_DYNAMIC or IMPLEMENT_DYNCREATE in your cpp file for CExodusDoc.
[/EDIT]
John
|
|
|
|
|
When I specify msvcrtd.lib, I get the following errors:
Linking...
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusDoc::classCExodusDoc" (?classCExodusDoc@CExodusDoc@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CMainFrame::classCMainFrame" (?classCMainFrame@CMainFrame@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusView::classCExodusView" (?classCExodusView@CExodusView@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/Exodus.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Exodus.exe - 5 error(s), 0 warning(s)
----------------------------------------------------------
The funny thing is that the program was working fine the first time I created it, then when I went to reopen the project...no go. It's got to be something simple. I'm reading a bunch of stuff on Google, but nothing to solve this problem yet.
Also, I did go into "options/directories" to specify the path to the library on my hardrive containing the msvcrtd file.
|
|
|
|
|
Your error has nothing to do with finding the msvcrtd.lib file. I believe that you are not getting the errors when you specify just msvcrtd because it is looking for msvcrtd.obj and it does not display the other errors because of the missing file. Did you try a build clean?
John
|
|
|
|
|
Yes, this is the message I receive...
Linking...
LINK : fatal error LNK1104: cannot open file "msvcrtd.obj"
Error executing link.exe.
Exodus.exe - 1 error(s), 0 warning(s)
I'm not sure what the problem is...I've searched Google for an hour.
|
|
|
|
|
You get this error because you are telling the compiler that you have a "msvcrtd.obj" to link with in your linker settings by not including the extension. Because vc++ does not have a "msvcrtd.obj" it is not found and the linker displays this error and ends. It does not display the other 5 errors because it assumes they are a result of the missing file. This behavior is similar to including a header file in a cpp file that does not exist.
John
|
|
|
|
|
I really appreciate your input on this John, thanks. I'm not exactly sure what I need to do at this point. If I remove the "msvcrdt" addition from the project/settings/link/library...I get the following errors...
Linking...
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusDoc::classCExodusDoc" (?classCExodusDoc@CExodusDoc@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CMainFrame::classCMainFrame" (?classCMainFrame@CMainFrame@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusView::classCExodusView" (?classCExodusView@CExodusView@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/Exodus.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Exodus.exe - 5 error(s), 0 warning(s)
-----------------------------------------------
with just the file "msvcrdt" typed in (with no extension), I get the following error...
Linking...
LINK : fatal error LNK1104: cannot open file "msvcrdt.obj"
Error executing link.exe.
Exodus.exe - 1 error(s), 0 warning(s)
What should I do on this? Thanks again.
|
|
|
|
|
DaveE9th wrote:
msvcrdt
This is spelt wrong - it should be "msvcrtd", and you need to specify the extension - .lib
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Ryan,
When I type in "msvcrtd.lib", I get the following error messages:
Linking...
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusDoc::classCExodusDoc" (?classCExodusDoc@CExodusDoc@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CMainFrame::classCMainFrame" (?classCMainFrame@CMainFrame@@2UCRuntimeClass@@B)
Exodus.obj : error LNK2001: unresolved external symbol "public: static struct CRuntimeClass const CExodusView::classCExodusView" (?classCExodusView@CExodusView@@2UCRuntimeClass@@B)
msvcrtd.lib(crtexe.obj) : error LNK2001: unresolved external symbol _main
Debug/Exodus.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.
Exodus.exe - 5 error(s), 0 warning(s)
|
|
|
|
|
As John said, the first 3 errors seem to suggest that you don't have IMPLEMENT_DYNCREATE() in the .cpp for the CExodusDoc, CMainFrame and CExodusView classes. The fourth error generally occurs because you're trying to compile a Win32 GUI application as though it's a Win32 console application, ie. you've stuffed up the project settings (probably not intentionally)
Check that the IMPLEMENT_DYNCREATE() lines are there, and put them in if they're not. To fix the last problem, Go to the Link tab of your project settings. In the edit box at the bottom, make sure you have "/subsystem:windows". If you have a different /subsystem, then change it. If it's not there then add it in.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
The first four errors are because you don't have IMPLEMENT_DYNAMIC or IMPLEMENT_DYNCREATE in your cpp file for CExodusDoc, CMainFrame, AND CExodusView I believe. I also believe the last error is because you are linking a crt library with a mfc program.
John
|
|
|
|
|