|
I've attached to another window's input by calling AttachThreadInput(). I'm now trying to send text, as follows:
int size = strlen(text);
for(int i=0; i
|
|
|
|
|
strlen return the number of characters excluding the null character at the end. You are sending one less than the number with your 'i<size' . Change it to i<=size and it should work as you want.
|
|
|
|
|
Nope, look at the following string: "hello"
strlen returns 5, which means the following characters are sent:
0 - 'h'
1 - 'e'
2 - 'l'
3 - 'l'
4 - 'o'
Besides if I send 2 string in a row still only the last character of the last string is ommitted, not the last characters of both strings.
|
|
|
|
|
Do you have control over the code receiving the WM_CHAR message? If not then I'm not sure how
you could expect the receiver to handle system messages being forced to it without knowing what
message it could currently be processing or its state or anything. It seems to me posting (not
sending) WM_KEYDOWN and WM_KEYUP and letting the receiver translate the WM_KEYDOWNs to WM_CHAR
messages may be safer.
Mark
|
|
|
|
|
whenwood wrote:
SendMessage(inputHwnd, WM_CHAR, text[i], 0);
better use SendInput api!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
|
WhiteSky wrote: See SendInput[^]
humm copying me
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and you
|
|
|
|
|
I am initialising GUI components (in a CMDIFrameWnd) using the code below.
It works fine, except that the CMDIChildWnd child frames are blank at startup. If the user fiddles with the child windows (e.g. stretches them) then the splitter displays immediately appear. What have I missed in the initialisation ?
CMainFrame* pMainFrame = new CMainFrame;
if (! pMainFrame->LoadFrame(IDR_MAINFRAME))
return FALSE;
CCreateContext context;
context.m_pCurrentDoc = NULL;
context.m_pCurrentFrame = NULL;
context.m_pLastView = NULL;
context.m_pNewDocTemplate = NULL;
context.m_pNewViewClass = NULL;
CMDIChildWnd* alertWnd = new CMDIChildWnd;
alertWnd->Create(NULL, "Alerts", WS_CHILD | WS_VISIBLE | WS_OVERLAPPEDWINDOW, CFrameWnd::rectDefault, pMainFrame);
CSplitterWnd* alertSplitter = new CSplitterWnd;
alertSplitter->CreateStatic(alertWnd, 1, 2, WS_CHILD | WS_VISIBLE, AFX_IDW_PANE_FIRST);
alertSplitter->CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), &context);
alertSplitter->CreateView(0, 1, RUNTIME_CLASS(CSsfconView), CSize(100, 100), &context);
pMainWnd->ShowWindow(SW_SHOW);
pMainWnd->UpdateWindow();
cheers,
Neil
|
|
|
|
|
What happens if you pass NULL instead of &context to alertSplitter->CreateView()?
Also, this call shouldn't be necessary - pMainWnd->UpdateWindow();
Maybe try without it.
CSplitterWnd* alertSplitter should maybe be a member variable of the MDIChild class (or somewhere)
so it can be deleted, otherwise a memory leak.
|
|
|
|
|
Can anyone tell me a way to find out why a program just compiled crashes? And what i mean by crashes, not when its run. But when i try and execute the program i get a Windows error. I've heard of debugging but i have not quite figured it out fully. Or if there is another simplier way of doing this please let me know. Thanx in advance!
|
|
|
|
|
You need to place a breakpoint on or before the line where the crash is happening. In your case, you don't know where, so place a breakpoint on the first line in you main(). Hit F5 to start debugging, the program will stop at the breakpoint. Then you can use F11 to move into a function ( your own functions ), or F10 to go to the next line. Keep doing this until you find out where it is crashing then have a look at your variables ( just hover your mouse over them ), one of them will probably be wrong.
|
|
|
|
|
What errors? did you use of breakpoint on your code
|
|
|
|
|
hi
im new at C++ and im looking for some help in way that i could understand what un .EXE file loads in to memory and all kind of information i could get like this applications:
http://www.microsoft.com/technet/sysinternals/ProcessesAndThreads/ProcessExplorer.mspx
it would be great if someone could help to initiate this learning, if you know a good tuturial that could help me in this way would be great... thank you!!
|
|
|
|
|
An exe will load itself and any dll's it requires into memory. If a dll has already been loaded by another exe, it shares it. Depending on the exe, any resources it requires, images text files, will be loaded and unloaded by the exe, but these items will only stay in memory for a short period.
|
|
|
|
|
if you see that software i show as a example, you will see what i mean with checking memory, handles, dll's everything associated... with the file.
|
|
|
|
|
|
|
I saw a good article on the www.codeguru.com about this object but I forgot its name if you can find it
|
|
|
|
|
Hi everyone;
I have written a MFC application and I want to add a MFC ODBC Consumer class to it. I opened the wizard and selected a data source. When I tried to finish the wizard I have been given a message as "Please select a datasource".
Why am I not able to select a datasource? Could you help me?
Thanks in advance.
Onur
|
|
|
|
|
Why you cant select a datasource? it shows to you the window that has two tabs File Data Source/Machine Data source
|
|
|
|
|
In File Data Source tab, I selected a data source that I created before but when I click finish button, it says "please select a datasource". I tried with creating a new datasource but nothing changed.
|
|
|
|
|
When You select data source and click ok button what happens
|
|
|
|
|
It returns to the Consumer Wizard. Also class, .h file and .cpp file part of the wizard is not editable.
|
|
|
|
|
Did you see window "Select Database Object"?
|
|
|
|
|
No. I right click to the project name and add -> class. Then MFC and MFC ODBC Consumer. Then, when I press add the wizard is seen. I press Data Source button and I select the data source.
|
|
|
|