Hello, I've just started learning Windows programming and here's my first program. It is very simple...but slightly humorous.
napKIN
Hello, I've just started learning Windows programming and here's my first program. It is very simple...but slightly humorous.
napKIN
"The best way to get answers is to just keep working the problem, recognizing when you are stalled, and directing the search pattern.....Don’t just wait for The Right Thing to strike you – try everything you think might even be in the right direction, so you can collect clues about the nature of the problem."
-John Carmack
Hello napkin
Can you post your source codes? I'm into Windows GUI programming and I'm hoping to learn a lot more from studying other's programs.
All men are created equal. But some are more equal than others.
Visit me at http://www.angelfire.com/my/billholm
LoL nice program, i had ME before, very unstable, but could i ask you one question?
How did you get the console window to stay behind the program? This could be very useful in debuging stuff.
"There are three kinds of people in the world...
Those that can count and those that can't."
question:
let say i have a Edit Box, a Button and a List Box. i'm going to type a message into the Edit Box and when i hit the Enter(or Return), the message is going to be appeared on the List Box. How can i do that?
thanatos
Billholm: I'll try to remember to bring in the code and post the code on Monday (I'm at school...)
Okie: The reason the console stays at the back is because I don't know how to make it go away(yet). If you have VC++6 go to File>New...>then under project select 'Console-application.'
Thanatos: Sorry but I'm just starting and can't answer that (yet)
Thanks for the responses!
napKIN
GetWindowText() and a SendMessage() work well for your listbox dillema...tell ya what, you put it in a nice post of your own and I'll answer it for you completely
Ok napkin. Monday then
All men are created equal. But some are more equal than others.
Visit me at http://www.angelfire.com/my/billholm
Okay napkin. On Monday then
All men are created equal. But some are more equal than others.
Visit me at http://www.angelfire.com/my/billholm
Sorry about my double post. My browser didn't update and I thought I lost my post.
All men are created equal. But some are more equal than others.
Visit me at http://www.angelfire.com/my/billholm
Ha, I thought yesterday was Friday! Wishful thinking I guess....Anyways, here's all the stuff minus the debug directory. The .rc (resource script) and resource.h files are required to compile.
napKIN
"The best way to get answers is to just keep working the problem, recognizing when you are stalled, and directing the search pattern.....Don’t just wait for The Right Thing to strike you – try everything you think might even be in the right direction, so you can collect clues about the nature of the problem."
-John Carmack
I can't remember exactly how, but you can do this. Give the edit box its own WndProc, and catch the WM_KEYDOWN message. Something like:
case WM_KEYDOWN:
switch(LOWORD(wParam))
{
case VK_RETURN:
GetWindowText(hwnd, buffer, 100);
SendMessage(hListBox, LB_ADDSTRING, (LPARAM) 100, (WPARAM) buffer);
break;
}
break;
Website(s): http://www16.brinkster.com/trifaze/
E-mail: [email protected]
---------------------------------
C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
DirectX Version: 9.0b
DX SDK: DirectX 8.1 SDK
To get rid of the console window, instead of going to Win32 Console Application, goto Win32 Application.
To make the text go in when enter is pressed, you can just make a default button and then the default button will respond to the return.
Ok napkin!
I already downloaded your code. I'm gonna try it at home
All men are created equal. But some are more equal than others.
Visit me at http://www.angelfire.com/my/billholm
SyntaxBubble:
i did what you suggested but still not ok.
part of the codes:
<code>
case WM_KEYDOWN:
switch(LOWORD(wParam))
{
case VK_RETURN:
int len=0;
char *textbuff;
len = GetWindowTextLength(GetDlgItem(hwnd,IDC_EDIT1));
textbuff=(char*)GlobalAlloc(GPTR,len+1);
GetDlgItemText(hwnd,IDC_EDIT1,textbuff,len+1);
SendDlgItemMessage(hwnd,IDC_LIST1,LB_ADDSTRING,0, (LPARAM)textbuff);
GlobalFree((HANDLE)textbuff);
break;
}
break;
<\code>
please advice.
thanatos
Use UBB instead of HTML code, Thonatos.