|
 |
07-31-2003, 08:06 PM
|
#1
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
calling windows c programmers
aight trying to use CreateProcess() for a remote control plugin and it's erroring up the ying yang now and it USED to work, the complied dll still works but just can't compile
here's the code
Code:
case RMCTRL_0:
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
CreateProcess( NULL, // No module name (use command line).
"\"C:\\Program Files\\Winamp\\Winamp.exe\"", // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ); // Pointer to PROCESS_INFORMATION structure.
return TRUE;
And here's the error msg:
Code:
Compiling...
Winamp.c
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(643) : error C2275: 'STARTUPINFO' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\winbase.h(3818) : see declaration of 'STARTUPINFO'
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(643) : error C2146: syntax error : missing ';' before identifier 'si'
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(643) : error C2065: 'si' : undeclared identifier
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(644) : error C2275: 'PROCESS_INFORMATION' : illegal use of this type as an expression
c:\program files\microsoft visual studio\vc98\include\winbase.h(234) : see declaration of 'PROCESS_INFORMATION'
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(644) : error C2146: syntax error : missing ';' before identifier 'pi'
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(644) : error C2065: 'pi' : undeclared identifier
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(647) : error C2224: left of '.cb' must have struct/union type
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(659) : warning C4133: 'function' : incompatible types - from 'int *' to 'struct _STARTUPINFOA *'
c:\documents and settings\bak\desktop\remotewonder\winampplugin20\winamp.c(660) : warning C4133: 'function' : incompatible types - from 'int *' to 'struct _PROCESS_INFORMATION *'
Error executing cl.exe.
I've been reading the MSDN pages and have taken code EXACTLY off their site and it errors.
I'm programming in VS6 on WinXP SP1
Thanks
|
|
|
|
|
|
Advertisement
|
Sponsored links
|
07-31-2003, 08:32 PM
|
#2
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
i'm a retard
forgot the { } brackets
|
|
|
08-01-2003, 03:44 AM
|
#3
|
|
I'm sorry, and you are....?
Join Date: Jan 2003
Location: Ruston, LA
Posts: 9,861
|
Quote:
Originally posted by freestyler
i'm a retard
forgot the { } brackets
gets you every time
__________________
[H]4 Life
My next generation Front End is right on schedule.
It will be done sometime in the next generation.
I'm a lesbian too.
I am for hire!
|
|
|
08-01-2003, 11:32 AM
|
#4
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
yea i know, i hate stupid things like that!!
now if i can only learn how to read and write to a dialog box i'll be all set
|
|
|
08-01-2003, 12:28 PM
|
#5
|
|
Low Bitrate
Join Date: May 2003
Location: Canada
Posts: 93
|
freestyler,
for a simple read/write, try "GetDlgItemText" and "SetDlgItemText" ... Basically if you had a textbox called "IDC_TEXT1" and a string callad "lpszText" and the handle to the dialogbox was called "hWndDiag", it would look like this:
to get the text in the textbox:
GetDlgItemText(hWndDiag, IDC_TEXT1, lpszText, strlen(lpszText) );
to set the text in the textbox:
SetDlgItemText(hWndDiag, IDC_TEXT1, lpszText );
cheers,
GTC
|
|
|
08-01-2003, 12:30 PM
|
#6
|
|
Maximum Bitrate
Join Date: Jul 2003
Location: Portland, OR, USA
Posts: 636
|
What program are you using to write it in? I am learning C++ currently, and have been using the GCC/G++ 3.3 compilers and Pico as my editor. Nice and clean, and I can do it from anywhere
__________________
1993 BMW 325is - 15.2sec
|
|
|
08-01-2003, 12:53 PM
|
#7
|
|
Registered User
Join Date: Jun 2002
Location: Omaha, Nebraska
Posts: 556
|
Quote:
Originally posted by SiGmA_X
What program are you using to write it in? I am learning C++ currently, and have been using the GCC/G++ 3.3 compilers and Pico as my editor. Nice and clean, and I can do it from anywhere
Make it easy on yourself and learn to use the vi editor. Saves a ton of time.
__________________
90% Done
60W DC-DC & shutdown controller
Via C3 800, 512mb Ram, HDD 75GB IBM Deskstar, 5.6" In dash Dcustoms LCD w/ 3m USB Touch setup
Rockfors 400s 400W amp,2x 10" Rockford Subs, Sony CDX M730 Head unit
All in a shiny White 2000 V6 Mustang
Click here to visit my NEW PhotoAlbum
|
|
|
08-01-2003, 01:11 PM
|
#8
|
|
Maximum Bitrate
Join Date: Jul 2003
Location: Portland, OR, USA
Posts: 636
|
Yeah, vi is elite  But I don't want to waste the time learning it.. It's what we use at work so I should learn it tho, damnit!
__________________
1993 BMW 325is - 15.2sec
|
|
|
08-01-2003, 06:58 PM
|
#9
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
Quote:
Originally posted by GTC
freestyler,
for a simple read/write, try "GetDlgItemText" and "SetDlgItemText" ... Basically if you had a textbox called "IDC_TEXT1" and a string callad "lpszText" and the handle to the dialogbox was called "hWndDiag", it would look like this:
to get the text in the textbox:
GetDlgItemText(hWndDiag, IDC_TEXT1, lpszText, strlen(lpszText) );
to set the text in the textbox:
SetDlgItemText(hWndDiag, IDC_TEXT1, lpszText );
cheers,
GTC
yeah that's what i thought, must have an error elsewhere, silly windows programming
|
|
|
08-01-2003, 09:23 PM
|
#10
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
ok here's what i have and it's not working:
Code:
#define BUFSIZE 80
#define ID_NUM_0 1040
#define ID_NUM_1 1041
#define ID_NUM_2 1042
#define ID_NUM_3 1043
#define ID_NUM_4 1044
#define ID_NUM_5 1045
#define ID_NUM_6 1046
#define ID_NUM_7 1047
#define ID_NUM_8 1048
#define ID_NUM_9 1049
FILE *fp;
int gFocusBoxState,gStopWatch,gResize,gVolume,gVolInc,gVer;
char NUM_0[BUFSIZE],NUM_1[BUFSIZE],NUM_2[BUFSIZE],NUM_3[BUFSIZE],NUM_4[BUFSIZE],NUM_5[BUFSIZE],NUM_6[BUFSIZE],NUM_7[BUFSIZE],NUM_8[BUFSIZE],NUM_9[BUFSIZE];
......
SetDlgItemText(hDlg, ID_NUM_1, NUM_1);
SetDlgItemText(hDlg, ID_NUM_2, NUM_2);
SetDlgItemText(hDlg, ID_NUM_3, NUM_3);
SetDlgItemText(hDlg, ID_NUM_4, NUM_4);
SetDlgItemText(hDlg, ID_NUM_5, NUM_5);
SetDlgItemText(hDlg, ID_NUM_6, NUM_6);
SetDlgItemText(hDlg, ID_NUM_7, NUM_7);
SetDlgItemText(hDlg, ID_NUM_8, NUM_8);
SetDlgItemText(hDlg, ID_NUM_9, NUM_9);
SetDlgItemText(hDlg, ID_NUM_0, NUM_0);
.........
GetDlgItemText(hDlg, ID_NUM_1, NUM_1, strlen(NUM_1));
GetDlgItemText(hDlg, ID_NUM_2, NUM_2, strlen(NUM_2));
GetDlgItemText(hDlg, ID_NUM_3, NUM_3, strlen(NUM_3));
GetDlgItemText(hDlg, ID_NUM_4, NUM_4, strlen(NUM_4));
GetDlgItemText(hDlg, ID_NUM_5, NUM_5, strlen(NUM_5));
GetDlgItemText(hDlg, ID_NUM_6, NUM_6, strlen(NUM_6));
GetDlgItemText(hDlg, ID_NUM_7, NUM_7, strlen(NUM_7));
GetDlgItemText(hDlg, ID_NUM_8, NUM_8, strlen(NUM_8));
GetDlgItemText(hDlg, ID_NUM_9, NUM_9, strlen(NUM_9));
GetDlgItemText(hDlg, ID_NUM_0, NUM_0, strlen(NUM_0));
ID_NUM_X are "Edit" boxes on the dialog box, NUM_X are just my global vars
GetDlgItemText & SetDlgItemText both don't seem to be working, the ini file that gets created isn't having anything wrote to it which would come from the dialog box
TIA
|
|
|
08-01-2003, 11:13 PM
|
#11
|
|
Low Bitrate
Join Date: May 2003
Location: Canada
Posts: 93
|
freestyler,
I can't comment on the .ini file since there isn't any code, but otherwise things look pretty good. However, I'd drop the strlen(x) in:
GetDlgItemText(hDlg, ID_NUM_1, NUM_1, strlen(NUM_1));
in favour of:
GetDlgItemText(hDlg, ID_NUM_1, NUM_1, BUFSIZE);
just for an optimization (why calculate stuff when you don't need to?).
Can you provide your code that gets the handle "hDlg" ? It's also good practice to write the code something like ...
HWND hDlg = NULL; /// init to null ... otherwise may contain random junk
hDlg = CreateDialog(hInst, lpTemplate, hWndParent, lpDialogFunc); // create ...
if (hDlg == NULL)
{ ... deal with a failure, ie call GetLastError() }
etc, etc ...
The easiest way to check, is to simply step through the code line by line and see which value(s) is/are "bad" ...
cheers,
GTC
|
|
|
08-01-2003, 11:40 PM
|
#12
|
|
Maximum Bitrate
Join Date: Jan 2002
Location: Chaska, MN
Posts: 695
|
attached is the code that i'm working with
just rename it to .c
|
|
|
08-02-2003, 05:45 AM
|
#13
|
|
Newbie
Join Date: Jun 2003
Posts: 11
|
with your GetDlgItemText's dont use strlen as the last paramater (because it's empty, until you actually put something in it so you're telling it the size of your storage buffer is 0 bytes), the last paramater is the maximum size of the buffer (to prevent buffer overflows), you can specify either BUFSIZE-1 or sizeof(NUM_0)-1 instead.
|
|
|
|
Sponsored links
|
|
Advertisement
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 10:51 AM.
| |