Hi all,
I intend to port a win32 application in C to Mac, using Carbon. I'd like to begin by a little training and I can't get myself displaying a simple window. I don't want any Nib files, I wanna create everything from scratch (no resource file neither).
Here is my code :
#include <stdio.h>
#include <Carbon/Carbon.h>
int main (/*int argc, const char * argv[]*/) {
WindowRef theWindow;
Rect contentRect;
OSStatus err;
printf("Start main!\n");
SetRect(&contentRect, 100,100,100,100);
err=CreateNewWindow(kDocumentWindowClass,kWindowStandardDocumentAttributes,&contentRect, &theWindow);
if(err==FALSE)printf("Error in CreateNewWindow\n");
ShowWindow(theWindow);
printf("End main!\n");
return 0;
}
I've read the tutorial on Apple.com by it doesn't help, and when I use the debugger, I see that CreateNewWindow returns an error, but WHAT ??
All I want is a simple window with Hello in there.
Pretty simple, and then I'll build upon that.
Can anyone help me ?
I don't know what to do with this "CreateNewWindow"...In Carbon, we can also use NewCWindow, but I can't get this working neither. I've got a good background with Java, but how do you dump the stack in C ?
Thanks
@ + Daz
I intend to port a win32 application in C to Mac, using Carbon. I'd like to begin by a little training and I can't get myself displaying a simple window. I don't want any Nib files, I wanna create everything from scratch (no resource file neither).
Here is my code :
#include <stdio.h>
#include <Carbon/Carbon.h>
int main (/*int argc, const char * argv[]*/) {
WindowRef theWindow;
Rect contentRect;
OSStatus err;
printf("Start main!\n");
SetRect(&contentRect, 100,100,100,100);
err=CreateNewWindow(kDocumentWindowClass,kWindowStandardDocumentAttributes,&contentRect, &theWindow);
if(err==FALSE)printf("Error in CreateNewWindow\n");
ShowWindow(theWindow);
printf("End main!\n");
return 0;
}
I've read the tutorial on Apple.com by it doesn't help, and when I use the debugger, I see that CreateNewWindow returns an error, but WHAT ??
All I want is a simple window with Hello in there.
Pretty simple, and then I'll build upon that.
Can anyone help me ?
I don't know what to do with this "CreateNewWindow"...In Carbon, we can also use NewCWindow, but I can't get this working neither. I've got a good background with Java, but how do you dump the stack in C ?
Thanks
@ + Daz