לוגו אתר Fresh          
 
 
  אפשרות תפריט  ראשי     אפשרות תפריט  צ'אט     אפשרות תפריט  מבזקים     אפשרות תפריט  צור קשר     חץ שמאלה ‎print ‎"Hello World!"; if‎ ‎not rules.‎know ‎then rules.‎read(); חץ ימינה  

לך אחורה   לובי הפורומים > מחשבים > תכנות ובניית אתרים
שמור לעצמך קישור לדף זה באתרי שמירת קישורים חברתיים
תגובה
 
כלי אשכול חפש באשכול זה



  #1  
ישן 20-10-2005, 01:14
צלמית המשתמש של shasho
  shasho shasho אינו מחובר  
 
חבר מתאריך: 15.03.05
הודעות: 204
שאלה קבצי האדר...

שלום, אני עובד בשפת c++ (דוס) (devcpp)
אני מתחיל כרגע ב winAPI ויש לי קוד שאני לא בניתי....



קוד PHP:
 #include <windows.h>

#include "resource.h"
const char g_szClassName[] = "myWindowClass";
HBITMAP g_hbmBall NULL;
HBITMAP g_hbmMask NULL;
HBITMAP CreateBitmapMask(HBITMAP hbmColourCOLORREF crTransparent)
{
HDC hdcMemhdcMem2;
HBITMAP hbmMask;
BITMAP bm;
GetObject(hbmColoursizeof(BITMAP), &bm);
hbmMask CreateBitmap(bm.bmWidthbm.bmHeight11NULL);
hdcMem CreateCompatibleDC(0);
hdcMem2 CreateCompatibleDC(0);
SelectObject(hdcMemhbmColour);
SelectObject(hdcMem2hbmMask);
SetBkColor(hdcMemcrTransparent);
BitBlt(hdcMem200bm.bmWidthbm.bmHeighthdcMem00SRCCOPY);
BitBlt(hdcMem00bm.bmWidthbm.bmHeighthdcMem200SRCINVERT);
DeleteDC(hdcMem);
DeleteDC(hdcMem2);
return 
hbmMask;
}
LRESULT CALLBACK WndProc(HWND hwndUINT msgWPARAM wParamLPARAM lParam)
{
switch(
msg)
{
case 
WM_CREATE:
g_hbmBall LoadBitmap(GetModuleHandle(NULL), MAKEINTRESOURCE(IDB_BALL));
if(
g_hbmBall == NULL)
    
MessageBox(hwnd"Could not load IDB_BALL!""Error"MB_OK MB_ICONEXCLAMATION);
g_hbmMask CreateBitmapMask(g_hbmBallRGB(000));
if(
g_hbmMask == NULL)
    
MessageBox(hwnd"Could not create mask!""Error"MB_OK MB_ICONEXCLAMATION);
break;
case 
WM_CLOSE:
DestroyWindow(hwnd);
break;
case 
WM_PAINT:
{
BITMAP bm;
RECT rcClient;
PAINTSTRUCT ps;
HDC hdc BeginPaint(hwnd, &ps);
HDC hdcMem CreateCompatibleDC(hdc);
HBITMAP hbmOld SelectObject(hdcMemg_hbmMask);
GetObject(g_hbmBallsizeof(bm), &bm);
GetClientRect(hwnd, &rcClient);
FillRect(hdc, &rcClientGetStockObject(LTGRAY_BRUSH));
BitBlt(hdc00bm.bmWidthbm.bmHeighthdcMem00SRCCOPY);
BitBlt(hdcbm.bmWidth0bm.bmWidthbm.bmHeighthdcMem00SRCAND);
BitBlt(hdcbm.bmWidth 2bm.bmHeight 2bm.bmWidthbm.bmHeighthdcMem00SRCAND);
SelectObject(hdcMemg_hbmBall);
BitBlt(hdc0bm.bmHeightbm.bmWidthbm.bmHeighthdcMem00SRCCOPY);
BitBlt(hdcbm.bmWidthbm.bmHeightbm.bmWidthbm.bmHeighthdcMem00SRCPAINT);
BitBlt(hdcbm.bmWidth 2bm.bmHeight 2bm.bmWidthbm.bmHeighthdcMem00SRCPAINT);
SelectObject(hdcMemhbmOld);
DeleteDC(hdcMem);
EndPaint(hwnd, &ps);
}
break;
case 
WM_DESTROY:
DeleteObject(g_hbmBall);
DeleteObject(g_hbmMask);
PostQuitMessage(0);
break;
default:
return 
DefWindowProc(hwndmsgwParamlParam);
}
return 
0;
}
int WINAPI WinMain(HINSTANCE hInstanceHINSTANCE hPrevInstance,
LPSTR lpCmdLineint nCmdShow)
{
WNDCLASSEX wc;
HWND hwnd;
MSG Msg;
wc.cbSize sizeof(WNDCLASSEX);
wc.style 0;
wc.lpfnWndProc WndProc;
wc.cbClsExtra 0;
wc.cbWndExtra 0;
wc.hInstance hInstance;
wc.hIcon LoadIcon(NULLIDI_APPLICATION);
wc.hCursor LoadCursor(NULLIDC_ARROW);
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wc.lpszMenuName NULL;
wc.lpszClassName g_szClassName;
wc.hIconSm LoadIcon(NULLIDI_APPLICATION);
if(!
RegisterClassEx(&wc))
{
MessageBox(NULL"Window Registration Failed!""Error!",
MB_ICONEXCLAMATION MB_OK);
return 
0;
}
hwnd CreateWindowEx(
WS_EX_CLIENTEDGE,
g_szClassName,
"Another Bitmap Program",
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULTCW_USEDEFAULT240160,
NULLNULLhInstanceNULL);
if(
hwnd == NULL)
{
MessageBox(NULL"Window Creation Failed!""Error!",
MB_ICONEXCLAMATION MB_OK);
return 
0;
}
ShowWindow(hwndnCmdShow);
UpdateWindow(hwnd);
while(
GetMessage(&MsgNULL00) > 0)
{
TranslateMessage(&Msg);
DispatchMessage(&Msg);
}
return 
Msg.wParam;




הקובץ שמור תחת השם bmp_two.c

יש עוד קובץ האדר ש"אני צריך לבנות" בשם resource.h (למטה)



קוד PHP:
 //{{NO_DEPENDENCIES}}

// Microsoft Developer Studio generated include file.
// Used by bmp_one.rc
//
#define IDB_BALL                        101
// Next default values for new objects
// 
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE         101
#endif
#endif 



הקובץ שמור תחת השם resource.h אבל הקוד לא עובד אני חושב שיש בעיה שהמהדר לא מזהה את הקובץ.
פתחתי פרוייקט של windows application ועכשיו זה כותב לי שגיאות:
C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\nnn\Untitled1.c In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':

61 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\nnn\Untitled1.c invalid conversion from `void*' to `HBITMAP__*'

66 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\nnn\Untitled1.c invalid conversion from `void*' to `HBRUSH__*'

66 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\nnn\Untitled1.c initializing argument 3 of `int FillRect(HDC__*, const RECT*, HBRUSH__*)'

C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\nnn\Makefile.win [Build Error] [Untitled1.o] Error 1

תודה מראש,
_____________________________________
Your signature did not follow Fresh's signatures policy, therefore it was automatically erased. Please see the E-Mail which has been sent to you, to learn how to fix this.

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #3  
ישן 20-10-2005, 09:58
צלמית המשתמש של shasho
  shasho shasho אינו מחובר  
 
חבר מתאריך: 15.03.05
הודעות: 204
שאלה הוספתי את הקובץ
בתגובה להודעה מספר 2 שנכתבה על ידי scripter שמתחילה ב ".."

אבל זה עדיין לא עובד. זה כותב לי שגיאות:

C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\v\main.c In function `LRESULT WndProc(HWND__*, UINT, WPARAM, LPARAM)':

61 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\v\main.c invalid conversion from `void*' to `HBITMAP__*'

66 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\v\main.c invalid conversion from `void*' to `HBRUSH__*'

66 C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\v\main.c initializing argument 3 of `int FillRect(HDC__*, const RECT*, HBRUSH__*)'

C:\Documents and Settings\user\&ugrave;&aring;&igrave;&ccedil;&iuml; &auml;&ograve;&aacute;&aring;&atilde;&auml;\v\Makefile.win [Build Error] [main.o] Error 1

בתודה מראש.
_____________________________________
Your signature did not follow Fresh's signatures policy, therefore it was automatically erased. Please see the E-Mail which has been sent to you, to learn how to fix this.

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
  #5  
ישן 20-10-2005, 18:16
צלמית המשתמש של shasho
  shasho shasho אינו מחובר  
 
חבר מתאריך: 15.03.05
הודעות: 204
בתגובה להודעה מספר 4 שנכתבה על ידי scripter שמתחילה ב "..."

<DIV dir=ltr align=left>
קוד PHP:
 [left]

//Microsoft Developer Studio generated resource script.
//
#include "resource.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef __BORLANDC__
#include "winres.h"
#endif
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (Canada) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENC)
#ifdef _WIN32
LANGUAGE LANG_ENGLISHSUBLANG_ENGLISH_CAN
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE DISCARDABLE 
BEGIN
    
"resource.h\0"
END
2 TEXTINCLUDE DISCARDABLE 
BEGIN
    
"#ifndef __BORLANDC__\r\n"
    "#include ""winres.h""\r\n"
    "#endif\r\n"
    "\0"
END
3 TEXTINCLUDE DISCARDABLE 
BEGIN
    
"\r\n"
    "\0"
END
#endif    // APSTUDIO_INVOKED
 
/////////////////////////////////////////////////////////////////////////////
//
// Bitmap
//
IDB_BALL                BITMAP DISCARDABLE     "ball.bmp"
#endif    // English (Canada) resources
/////////////////////////////////////////////////////////////////////////////
 
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
 
/////////////////////////////////////////////////////////////////////////////
#endif    // not APSTUDIO_INVOKED
 
[/left




תודה,
_____________________________________
Your signature did not follow Fresh's signatures policy, therefore it was automatically erased. Please see the E-Mail which has been sent to you, to learn how to fix this.

תגובה ללא ציטוט תגובה עם ציטוט חזרה לפורום
תגובה

כלי אשכול חפש באשכול זה
חפש באשכול זה:

חיפוש מתקדם
מצבי תצוגה דרג אשכול זה
דרג אשכול זה:

מזער את תיבת המידע אפשרויות משלוח הודעות
אתה לא יכול לפתוח אשכולות חדשים
אתה לא יכול להגיב לאשכולות
אתה לא יכול לצרף קבצים
אתה לא יכול לערוך את ההודעות שלך

קוד vB פעיל
קוד [IMG] פעיל
קוד HTML כבוי
מעבר לפורום



כל הזמנים המוצגים בדף זה הם לפי איזור זמן GMT +2. השעה כעת היא 04:39

הדף נוצר ב 0.26 שניות עם 10 שאילתות

הפורום מבוסס על vBulletin, גירסא 3.0.6
כל הזכויות לתוכנת הפורומים שמורות © 2024 - 2000 לחברת Jelsoft Enterprises.
כל הזכויות שמורות ל Fresh.co.il ©

צור קשר | תקנון האתר