Jump to content
  • Advertisement
Sign in to follow this  
Dustman

Question about GDI graphics???????

This topic is 5005 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

could someone tell me the header file for GDI graphics for the free version of borland 5.5 c++?????????????

Share this post


Link to post
Share on other sites
Advertisement
The compiler you're using shouldn't matter.

The majority of GDI functions are included from "Wingdi.h", that header itself is included from "Windows.h" which you'll need for basic things such as opening a window.


If you have neither then you need to obtain the Windows Platform SDK which contains all those headers and other stuff (I'm sure Borland C++ ships with a version of the PSDK though - so it might be a setup issue)

Share this post


Link to post
Share on other sites
OK thanks, and umm could someone post a compilable example of some code just to draw a line??? please!!!!!!!!!!!!!

Share this post


Link to post
Share on other sites
here's a simple line drawing example. you will start at 0, 0 (uppser left corner) by default and draw a line to 100, 100.


#include <windows.h>

LRESULT CALLBACK LineProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(Msg)
{
case WM_CLOSE:
PostQuitMessage(0);
break;
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
LineTo(hdc, 100, 100);
EndPaint(hWnd, &ps);
break;
}
return DefWindowProc(hWnd, Msg, wParam, lParam);
}

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
MSG msg;
WNDCLASS wc = {0};
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.lpfnWndProc = LineProc;
wc.lpszClassName = "Simple Line";

RegisterClass(&wc);
CreateWindow(wc.lpszClassName, "A simple line", WS_OVERLAPPEDWINDOW|WS_VISIBLE, 0, 0, 640, 480,
NULL, NULL, NULL, NULL);
while(GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return 0;
}



hope that helps.

Share this post


Link to post
Share on other sites
It had an error. " Unresolved external '_main' referenced from C:\BORLAND\BCC55\LIB\C0X32.OBJ"
what the crap does that mean?

Share this post


Link to post
Share on other sites
It means you're not compling it correctly.

Google for some tutorials on writing win32 applications with borland. They should mention how to set up the project so that you don't get that error.

Share this post


Link to post
Share on other sites
yeah, i think you need to set your target to Win32. they don't need main() to run. if using the commandline compiler, it's a flag you set. i forget which one, (maybe -w ???), look at Borlands site. they have some information about it.

EDIT: dammit. gotta be quicker.

Share this post


Link to post
Share on other sites
Ive already set it up, i did it step by step on some site, and ive already compiled like hundreds of programs, but none of then have graphics!!!!!

Share this post


Link to post
Share on other sites
Firstly, calm down. A single exclamation mark or question mark is enough, you do not need seven.

Secondly, this has become a compiler/buildconfig issue, and does not belong in GP&T. Moving to For Beginners.

Share this post


Link to post
Share on other sites
oh and im using the FREE BORLAND 5.5 COMPILER AND ITS A COMAND LINE COMPILER!!!!!!!!!!!!! and i saw a little thing on it about that there a graphics window and a text window, and there like a command like closegraph or something? because it said that this free compiler can only use gdi graphics. so im looking for somone to tell me BUT SO FAR NO ONE IS!!! ive been looking for tutorials for like a month but i havent found any that my compiler can compile!!!!!!! SOMEONE please help!!!!!!!!!!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!