|
The problem could be this...
class AClass
{
}<code>
You use it like this...
<code>#include "anincludefile.h"</code>
#include "vector" Check and see if this is the problem...
Nibu thomas
Software Developer
|
|
|
|
|
Dear MFC friends,
I have a function for a combo box control in a dialog box,
void CLassnameDlg::OnCbnSelchangeComboboxControl();
I don't know why I could not do the following when the selection in the control has changed,
1. the content within the function doesn't work;
2. I could not do "Run To Cursor" within the function;
3. I set breakpoint at the right place within the function but doesn't work.
The type of the combo box control is "Drop List". In the same dialog I have several combo box controls, some are working and some are not working.
What's wrong? Could you please tell me?
Thanks,
Joy Anne
|
|
|
|
|
Scan the Message map section to find out if the combo that you are expecting to work is correctly mapped on to the function that you expect to get called for that particular combo.
Check the ID of the combo.
Nibu thomas
Software Developer
|
|
|
|
|
Hello
I am creating a win32 console application. I wanted to show output in full screen mode. I used following code by MSDN to do it. But nothing happens after when this code runs.
HWND hwndConsole = NULL;<br />
hwndConsole = FindWindow(NULL, "test.exe");<br />
if(NULL != hwndConsole)<br />
{<br />
SetForegroundWindow(hwndConsole);<br />
ShowWindow(hwndConsole, SW_MAXIMIZE);<br />
}
Please tell me what is "test.exe". Is it output file of my project.
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Aqueel wrote: Please tell me what is "test.exe". Is it output file of my project.
Thank you.
Yes you are right.
It is trying to get the handle to the console window based on it's caption. This won't work. As caption contains the full path.
Aqueel wrote: But nothing happens after when this code runs.
This is because hwndConsole is NULL.
Do the following to get it working...
TCHAR oldTitle[MAX_PATH];
GetConsoleTitle(oldTitle, MAX_PATH);
TCHAR *newTitle = _T("My new title...zx1213");
SetConsoleTitle(newTitle);
HWND hwndConsole = NULL;
hwndConsole = FindWindow(NULL, newTitle);
if(NULL != hwndConsole)
{
SetForegroundWindow(hwndConsole);
ShowWindow(hwndConsole, SW_MAXIMIZE);
}
SetConsoleTitle(oldTitle); Nibu thomas
Software Developer
|
|
|
|
|
Hello
Now i have changed the path and now code is as follows.
HWND hwndConsole ;<br />
hwndConsole = FindWindow(NULL, "C:\\temp\\myapp.exe");<br />
if (hwndConsole == NULL)<br />
cout <<"Window not found"<<endl;<br />
if(NULL != hwndConsole)<br />
{<br />
SetForegroundWindow(hwndConsole);<br />
ShowWindow(hwndConsole, SW_MAXIMIZE); }
Here myapp.exe is name of my output file. But again nothing happens.
Thank you for your help.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Check the sample code that I've given.
Nibu thomas
Software Developer
|
|
|
|
|
Thank you Nibu!
I used your code. It works but it only maximizes the console window. It does not open in full screen mode. Can you tell me what i have to do?
Thank you.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Include this piece of code in main...
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
Nibu thomas
Software Developer
|
|
|
|
|
Thank you Nibu
I works... It's great. Can you please tell me what is the purpose of this piece of code. What it does?
Thank you
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
keybd_event(VK_MENU,0x38,0,0);
keybd_event(VK_RETURN,0x1c,0,0);
keybd_event(VK_RETURN,0x1c,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0x38,KEYEVENTF_KEYUP,0);
This simulates an Alt+Enter key combination. This is how we programmatically trigger a keyboard event.
1. First argument is the virtual key code of the key that is pressed. Here VK_MENU means Alt key.
2. The second argument is not required as per MSDN but here it won't work unless we pass the scan code. The second argument is the scan code of the virtual key.
3. The Third argument denotes whether it's key up event or key down event. If it is key down then we pass zero else we pass KEYEVENTF_KEYUP .
4. The fourth argument is for supplying any additional data.
Nibu thomas
Software Developer
|
|
|
|
|
On a side note, Windows is called Windows for a reason - if your going to force the user into fullscreen mode you'd be better asking them first.
Check out the MSDN documentation on SetConsoleDisplayMode[^], offically it only works on Windows XP upwards but i'm pretty sure it works on 2000 as well - it was just undocumented
For backwards compatibilty with other OS's you should really load it in dynamically and access it on the fly... code as follows:
typedef BOOL (WINAPI *PSCDM)(HANDLE, DWORD, PCOORD);
#define CONSOLE_FULLSCREEN_MODE 1 // From MSDN
#define CONSOLE_WINDOWED_MODE 2 // From MSDN
static PSCDM g_pfSetConsoleMode = NULL;
static BOOL g_bSetConsoleModeLoaded = FALSE;
BOOL MakeMeFullScreen( DWORD dwFlags )
{
HANDLE hStd = NULL;
COORD co = { 0, 0 };
if ( ! g_bSetConsoleModeLoaded )
{
HMODULE hDLL = LoadLibrary( TEXT( "kernel32.dll" ) );
g_pfSetConsoleMode = ( PSCDM ) GetProcAddress( hDLL, "SetConsoleDisplayMode" );
g_bSetConsoleModeLoaded = TRUE;
}
if ( g_pfSetConsoleMode == NULL )
return FALSE;
hStd = GetStdHandle( STD_OUTPUT_HANDLE );
if( ( hStd == INVALID_HANDLE_VALUE ) || ( hStd == NULL ) )
return FALSE;
return g_pfSetConsoleMode( hStd, dwFlags, & co );
}
Gavin Taylor
w: http://www.gavspace.com
-- modified at 6:10 Wednesday 15th March, 2006
|
|
|
|
|
Hi,
Can anyone tell me or refer me any document that tells in details as how Message Mappings are handled in a SDI application and MDI application. Most of the documents talks only abt the underlying concept of SDI/MDI, but i need to know as how the Message Maps are handled in these king of application.
Thanks in Advance
|
|
|
|
|
You may read Progrmmaing Windows 95 in MFC, written bij Jeff Prosise. It is already an old book, mebe there are some newer versions, but it explains very well how MFC works. It has a chapter on message handling.
Regards
Rudolf Heijink
|
|
|
|
|
Hi everybody,
In my dialog based application ,i should open up an "Notepad" when the user clicks an button in the dialog.I'm using
flushall();
system("notepad");
functions to open the notepad.Theproblem is when i open the notepad it opens up with the command prompt window and when i want to close the notepad the dialog doesnt gets repainted properly and it looks disfigured.It'll be really great if anyone can help me out in this.
Thanks and regards,
Rajeev
|
|
|
|
|
Use ShellExecute or CreateProcess .
A demo[^]
Nibu thomas
Software Developer
|
|
|
|
|
try to use ShellExecute(...) to open notepade.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
ShellCreate(..),system(...) and CreateProcess are all opening the notepad ,but my actual problem is refreshing the screen(painiting it again) after the notepad is opened.How do i solve that
|
|
|
|
|
What You need to refresh screen?
|
|
|
|
|
SHELLEXECUTEINFO shell;
memset(&shell, 0, sizeof(SHELLEXECUTEINFO));
shell.cbSize=sizeof(SHELLEXECUTEINFO);
shell.lpVerb=_T("open");
shell.hwnd=m_hWnd;
shell.nShow=1;
shell.lpFile=_T("Notepad.exe");
ShellExecuteEx(&shell);
|
|
|
|
|
Normally this should not be a problem. To me it seems that you block your application somehow to proceed. I think system() is a call that blocks progress of the program invoking it. So while Notepad is active repainting will be prevented. Maybe using ShellExecute() in stead of system() will solve your problem.
Regards,
Rudolf Heijink
|
|
|
|
|
Hi all,
I've developed one dialog base application in which there is an edit box with multiline selection enabled.
after entering an text into the edit box, if i click "ENTER" key to get to the next line the application closes up.What could be the reason??
could anyone help me out in this please.
Thanks And Regards,
Rajeev
|
|
|
|
|
Make sure the ES_WANTRETURN is set on the edit control. Without this the dialog handles the keystroke and interprets it as a press of the default button (the button with a darker border around it). The dialog editor allows you to set this style.
Steve
|
|
|
|
|
rajeev82 wrote: if i click "ENTER" key to get to the next line the application closes up.What could be the reason??
Set the "Want return" property of the edit box to TRUE .
Nibu thomas
Software Developer
|
|
|
|
|
Thanks a Lot for ur help!!!!!!!!
|
|
|
|