ok i read it and was able to save the char array as a string. Now I want this function in my other program. How do i combine this
Code:
case WM_CREATE:
hwndEdit = CreateWindow(TEXT("Edit"), NULL, WS_CHILD | WS_VISIBLE | WS_BORDER,
50, 50, 150, 20, hwnd, (HMENU) ID_EDIT,
NULL, NULL);
hwndButton = CreateWindow(
TEXT("button"), TEXT("ok"),
WS_VISIBLE | WS_CHILD,
50, 100, 80, 25,
hwnd, (HMENU) ID_BUTTON, NULL, NULL);
break;
case WM_COMMAND:
if (HIWORD(wParam) == BN_CLICKED) {
len = GetWindowTextLength(hwndEdit) + 1;
GetWindowText(hwndEdit, text, len);
string myString =text;
// char *myCharArray = (char*)myString.c_str();
// SetWindowText(hwnd, myCharArray);
}
break;
with this
Code:
#include <windows.h>
#include <stdlib.h>
#include <string>
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow )
{
MSG msg ;
WNDCLASS wc = {0};
wc.lpszClassName = TEXT( "Buttons" );
wc.hInstance = hInstance ;
wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
wc.lpfnWndProc = WndProc ;
wc.hCursor = LoadCursor(0, IDC_ARROW);
RegisterClass(&wc);
CreateWindow( wc.lpszClassName, TEXT("XMLtoCSV"),
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
150, 150, 230, 150, 0, 0, hInstance, 0);
while( GetMessage(&msg, NULL, 0, 0)) {
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return (int) msg.wParam;
}
LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
{
switch(msg)
{
case WM_CREATE:
{
CreateWindow(TEXT("button"), TEXT("XML to CSV"),
WS_VISIBLE | WS_CHILD ,
20, 30, 80, 25,
hwnd, (HMENU) 1, NULL, NULL);
CreateWindow(TEXT("button"), TEXT("Split CSV"),
WS_VISIBLE | WS_CHILD ,
20, 70, 80, 25,
hwnd, (HMENU) 2, NULL, NULL);
CreateWindow(TEXT("button"), TEXT("Quit"),
WS_VISIBLE | WS_CHILD ,
120, 50, 80, 25,
hwnd, (HMENU) 3, NULL, NULL);
break;
}
case WM_COMMAND:
{
if (LOWORD(wParam) == 2) {
system("CSVS.bat");
}
if (LOWORD(wParam) == 1) {
//codes goes here--------------------------
}
if (LOWORD(wParam) == 3) {
PostQuitMessage(0);
}
break;
}
case WM_DESTROY:
{
PostQuitMessage(0);
break;
}
}
return DefWindowProc(hwnd, msg, wParam, lParam);
}
I want it to make it so that it has a text box when the person click button one.