-
10-09-2010, 10:40 AM #1Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Mã:#pragma comment(lib, "winmm.lib")
View more random threads:
- default value for non-static class member?
- lỗi: cấp phát thu hồi trong Visual C++
- hỏi về lớp vector trong vs c++
- Cách đăng kí ActiveX control trên VC++6.0 như thế nào?
- Mảng ký tự 2 chiều Trong CString như thế nào
- Liên lạc giữa Diaglog Parent và Dialog Child
- Set Priority cho các Thread của Process?
- [Lập trình SOCKET] Hàm Recv() trong 1 Thread có bị block hay không ?
- Tại Sao KAV bắt là URLDownloadToFile là virus
- đọc file .vcf như thế nào
-
10-09-2010, 07:13 PM #2Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Lỗi chương trình HelloWin ko compile được
Lỗi chương trình HelloWin ko compile được. Em đọc ebook mới gặp cái code này đã bị lỗi, mấy anh xem giúp em với. Thanks [IMG]images/smilies/biggrin.png[/IMG]
Mã:HELLOWIN.C /*------------------------------------------------------------ HELLOWIN.C -- Displays "Hello, Windows 98!" in client area (c) Charles Petzold, 1998 ------------------------------------------------------------*/ #include <windows.h> LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow){ static TCHAR szAppName[] = TEXT ("HelloWin") ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName = NULL ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindow (szAppName, // window class name TEXT ("The Hello Program"), // window caption WS_OVERLAPPEDWINDOW, // window style CW_USEDEFAULT, // initial x position CW_USEDEFAULT, // initial y position CW_USEDEFAULT, // initial x size CW_USEDEFAULT, // initial y size NULL, // parent window handle NULL, // window menu handle hInstance, // program instance handle NULL) ; // creation parameters ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; while (GetMessage (&msg, NULL, 0, 0)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } return msg.wParam ;} LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ HDC hdc ; PAINTSTRUCT ps ; RECT rect ; switch (message) { case WM_CREATE: PlaySound (TEXT ("hellowin.wav"), NULL, SND_FILENAME | SND_ASYNC) ; return 0 ; case WM_PAINT: hdc = BeginPaint (hwnd, &ps) ; GetClientRect (hwnd, &rect) ; DrawText (hdc, TEXT ("Hello, Windows 98!"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER) ; EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY: PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ;}
-
10-09-2010, 07:29 PM #3Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
trong phần chú thích của ebook có ghi hướng dẫn thêm vào multimedia library, nhưng em ko biết làm vì hướng dẫn này ko dùng cho Visual Studio 2008.
- A couple of warnings (2 điểm lưu ý): If you use Microsoft Visual C++ to create a new project for this program, you need to make an addition to the object libraries the linker uses. Select the Settings option from the Project menu, and pick the Link tab. Select General from the Category list box, and add WINMM.LIB ("Windows multimedia") to the Object/Library Modules text box. You need to do this because HELLOWIN makes use of a multimedia function call, and the multimedia object library isn't included in a default project. Otherwise (hoặc là, nếu ko) you'll get an error message from the linker indicating (cho biết) that the PlaySound function is unresolved (ko xử lí được).
Em ko biết file WINMM.LIB nằm ở đâu. Mấy anh xem giúp em với.
-
11-09-2010, 09:26 AM #4Junior Member
- Ngày tham gia
- Sep 2015
- Bài viết
- 0
Nếu bạn dùng Visual studio 2008 thì có thể biên dịch như sau (không cần tạo project):
Vào:
Mã:Start -> All program -> Microsoft Visual Studio 2008 -> Visual Studio Tools -> Visual Studio 2008 Command Prompt
Mã:cl HELLOWIN.C user32.lib gdi32.lib winmm.lib
Pallet nhựa Lâm Đồng giải pháp hoàn hảo cho nhà kho Pallet nhựa Lâm Đồng là một giải pháp đa năng và hiệu quả trong việc vận chuyển và lưu trữ hàng hóa. Trong đó, pallet nhựa Lâm Đồng không chỉ đáp...
Pallet nhựa Lâm Đồng giải pháp...