Need help with windows app functions in C

In summary, the conversation is about using a function in a Windows application. The person has experience with creating dropdown lists and dialog boxes, but is unsure how to incorporate a function into the application. They mention wanting to display the value of the function in a dialog box and are open to using either C or C++ versions. It is suggested to convert the result into a string and use SetWindowText() or MessageBox. A resource for samples is also provided.
  • #1
VirObitus
19
0
Hello folks,

Ok, I've been doing windows application tutorials, and I can make a mean dropdown list and dialog box, but I have no idea how to get the windows app to use a function. Say I just want a dialog box to pop up and use the function:

int myFunction ()
{
int i = 1;

return i;
}

to display the value of i in the dialog box. How do I do that, or something similar?
C or C++ versions are both acceptable.
 
Technology news on Phys.org
  • #2
It depends on the GUI toolkit.
Normally you convert the result into a string and then call something like SetwindowText() for the edit box.

Take a look here for samples http://www.functionx.com/visualc/
 
  • #3
Right. I ended up converting it to a string and using MessageBox. Problem solved.
 

Related to Need help with windows app functions in C

1. How do I initialize a Windows app in C?

To initialize a Windows app in C, you will need to include the #include header file in your code. Then, you can use the WinMain() function to create a new instance of your app and handle any necessary initialization tasks.

2. How can I create a window in my Windows app using C?

To create a window in your Windows app using C, you can use the CreateWindow() function. This function takes in parameters such as the window class name, window title, window style, and window size to create a new window on the screen.

3. How can I handle user input in my Windows app in C?

To handle user input in your Windows app in C, you can use the GetMessage() and DispatchMessage() functions. These functions allow you to retrieve messages from the app's message queue and then process and respond to them accordingly.

4. How do I add buttons and other controls to my Windows app in C?

To add buttons and other controls to your Windows app in C, you can use the CreateWindow() function with the appropriate window class names for each control. For example, to create a button, you would use the BUTTON window class name and specify the button's text, location, and size.

5. How can I handle errors and exceptions in my Windows app written in C?

To handle errors and exceptions in your Windows app written in C, you can use the try-catch statement. This allows you to catch and handle any errors or exceptions that may occur in your code, ensuring that your app runs smoothly and does not crash.

Similar threads

  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
14
Views
2K
  • Programming and Computer Science
Replies
15
Views
5K
  • Programming and Computer Science
Replies
19
Views
3K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
2
Replies
39
Views
3K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
27
Views
14K
  • Programming and Computer Science
Replies
16
Views
4K
  • Programming and Computer Science
Replies
20
Views
1K
Back
Top