Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with the Win32 API
Index -> Programming, C++ -> C++ Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
deville75




PostPosted: Thu Jan 18, 2007 2:08 pm   Post subject: Help with the Win32 API

Hey guys, I'm making a program for work and I'm using Win32 API for teh GUI. I have a few questions, but for now I just need to know one thing. When I compile and execute the program, an application shows up in the Debug folder of my project folder. This application has an icon as well.. How do I change the icon of this program?
Sponsor
Sponsor
Sponsor
sponsor
apomb




PostPosted: Thu Jan 18, 2007 2:41 pm   Post subject: RE:Help with the Win32 API

URL
^click^
deville75




PostPosted: Thu Jan 18, 2007 4:47 pm   Post subject: RE:Help with the Win32 API

ahha, thanks man.. just figured it out though. I forgot to make 16x16 icons so it didn't show up before.
deville75




PostPosted: Thu Jan 18, 2007 4:51 pm   Post subject: Re: Help with the Win32 API

Well that brings me to my next question. I need to retrieve a value from a dialog box and store it in an integer. For example, my button will open a dialog box and it'll as the user to enter a delay time. So the user will enter a number in seconds into the text box with ID: IDC_DELAY. I have a variable: int *delay; I want to assign whatever the user enters into my variable 'delay'. Do I simply write: delay = IDC_DELAY; ??? I tried it, but I can't seem to test it. Which brings me to another question. How do I output variables onto a dialog box that I've declared in my .cpp file?

Thanks for your help!
abcdefghijklmnopqrstuvwxy




PostPosted: Thu Jan 18, 2007 8:49 pm   Post subject: Re: Help with the Win32 API

Quote:

Do I simply write: delay = IDC_DELAY;

I don't think so... If anything wouldn't it be delay = &IDC_DELAY; ?

For your last question: it depends on which API call your using to call a dialogue box. But I think you have to cast the variable to a char[] first...

Are you using the win32 API to make a GUI? Wouldn't this be accomplished MUCH easier with VB or with C#? The most important quality of a good programmer IMO is picking the best tool for the job...[/quote]
deville75




PostPosted: Fri Jan 19, 2007 9:22 am   Post subject: Re: Help with the Win32 API

abcdefghijklmnopqrstuvwxy @ Thu Jan 18, 2007 8:49 pm wrote:
Quote:

Do I simply write: delay = IDC_DELAY;

I don't think so... If anything wouldn't it be delay = &IDC_DELAY; ?

For your last question: it depends on which API call your using to call a dialogue box. But I think you have to cast the variable to a char[] first...

Are you using the win32 API to make a GUI? Wouldn't this be accomplished MUCH easier with VB or with C#? The most important quality of a good programmer IMO is picking the best tool for the job...
[/quote]

Hmm very true... Ya I think you're right about &IDC_DELAY. And the reason I'm using win32API is because my Boss made a program in C++. The program runs in the DOS command prompt though, and he'd like me to make a pretty (with GUI) version of it. So I seem to have no choice but to use the Win32 API.

Also, I might have been able to convert from C# to C++, but the program uses a header file made by a company. (Basically I'm communicating with a device through USB). BUt to do this properly I need all the functions defined in the header file. Which is quite a few thousand lines. I dont know if this could be converted to C# or VB.
abcdefghijklmnopqrstuvwxy




PostPosted: Fri Jan 19, 2007 9:41 am   Post subject: RE:Help with the Win32 API

you could always resort to programming certain parts in c++ and doing the gui in C# couldn't you? I mean you hardly have to code the gui in C#, all you do is point and click like your in paint or something and it does most of the coding...
deville75




PostPosted: Fri Jan 19, 2007 9:43 am   Post subject: RE:Help with the Win32 API

Oh and I tested doing delay = &IDC_DELAY;

It gives me an error this time and it says: & on constant. IDC_DELAY is the ID of a text box.. does that mean it's a constant? Also I'm not quite sure how to concatenate to char[]. What if I have an integer.. how do i concatenate to char and output it on a dialog box.
Sponsor
Sponsor
Sponsor
sponsor
deville75




PostPosted: Fri Jan 19, 2007 9:45 am   Post subject: Re: RE:Help with the Win32 API

abcdefghijklmnopqrstuvwxy @ Fri Jan 19, 2007 9:41 am wrote:
you could always resort to programming certain parts in c++ and doing the gui in C# couldn't you? I mean you hardly have to code the gui in C#, all you do is point and click like your in paint or something and it does most of the coding...


hmm seriously? I did not know that. So how do I manage to do this.. and What program lets me draw the GUI?
abcdefghijklmnopqrstuvwxy




PostPosted: Fri Jan 19, 2007 9:50 am   Post subject: RE:Help with the Win32 API

google c# express edition.. its free i think still. install it and create a gui project and you'll see the menu come up for boxes, captions, scroll boxes, etc.

And another alternative than using strict win32 api is to use something like SDL/c++ and download a windows gui library. Its not as good as c# but it would make your gui look custom...
deville75




PostPosted: Fri Jan 19, 2007 9:58 am   Post subject: RE:Help with the Win32 API

is this it?
http://msdn.microsoft.com/vstudio/express/visualcsharp/


And I'm still not sure how I'd manage doing some code in C++.. How am I going to transfer the data that is being read by the C++ program (the data is from the device) to my C# GUI program?
abcdefghijklmnopqrstuvwxy




PostPosted: Fri Jan 19, 2007 10:01 am   Post subject: RE:Help with the Win32 API

about IDC_DELAY i was wrong... i misunderstood what you were saying. You can't assign the contents of the textbox to an int* because it is a char[].

you don't concatenate int into char, you convert it.

char an_array[99];
sprintf(an_array, "%d", an_int);
abcdefghijklmnopqrstuvwxy




PostPosted: Fri Jan 19, 2007 10:03 am   Post subject: RE:Help with the Win32 API

yeah that is it.

Quote:

And I'm still not sure how I'd manage doing some code in C++.. How am I going to transfer the data that is being read by the C++ program (the data is from the device) to my C# GUI program?


Don't ask me, I've never done anything like that. But I know it is possible so you can at least go from there.
deville75




PostPosted: Fri Jan 19, 2007 10:08 am   Post subject: RE:Help with the Win32 API

kool.. thanks a lot man. You've been really helpful. Just one more question. Since IDC_DELAY is a char[] i guess i can use sprintf again and convert it back into an int?

char an_array[99];
sprintf(an_array, "%d", an_int);

i'm guessing an_int is of type int []

and what does "%d" do?
wtd




PostPosted: Fri Jan 19, 2007 11:19 am   Post subject: RE:Help with the Win32 API

In C's printf mini-language, %d is a format specifier which indicates an integer.
Display posts from previous:   
   Index -> Programming, C++ -> C++ Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: