1.windowwsԴ?源码?
2.c++如何使创建的窗口大小不可以改变的源代码
windowwsԴ??
呵呵,一年半前我和你一样,源码也处于这个状态,源码如果你做windows的源码h5 个人中心 源码程序设计的话,编程像windows这样的源码窗口化的软件,你必须接触VS,源码短剧授权源码旗下的源码VC++或VC#,你学完c和c++先接触VC++的源码MFC较为容易,使用MFC APP向导可以直接生成你所说的源码windows这样窗口程序,刚开始你是源码不知道如何生成的,为此你需要边学windows程序设计,源码建议使用《windows程序设计》,源码里面介绍了一个基本窗体生成的源码源码分享教程原理和步骤。如果你要学VC#,源码那你得先学C#,源码离做一个windows这样窗口程序比较远,probus dp源码而且也不知道它生成的原理,当然既然c和c++学的不错的话,c#入门也不难。农历编程源码如下是一个窗体生成的windows源码:
/*--------------------------------------
CLOCK.C -- Analog Clock Program
(c) Charles Petzold,
--------------------------------------*/
#include <windows.h>
#include <math.h>
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Clock") ;
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 = NULL ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("GDI Test"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
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)
{
static HDC hdc;
static PAINTSTRUCT ps;
static COLORREF color;
static UINT ixClient,iyClient;
static RECT rtWindow , rtClient;
switch (message)
{
case WM_CREATE :
GetWindowRect( hwnd , &rtWindow );
GetClientRect( hwnd , &rtClient );
return 0 ;
case WM_NCPAINT:
hdc = GetWindowDC( hwnd );
color = GetPixel( hdc , , 5 );
SetBkColor( hdc , color );
SetTextColor( hdc , RGB(,0,0) );
TextOut( hdc , , ,
"Editor : CM" , strlen("Editor : CM") );
ReleaseDC( hwnd , hdc );
return 0;
case WM_SIZE :
ixClient = LOWORD( wParam );
iyClient = HIWORD( wParam );
return 0 ;
case WM_TIMER :
return 0 ;
case WM_PAINT :
hdc = BeginPaint (hwnd, &ps) ;
TextOut( hdc , , , "Editor : CM" , strlen("Editor : CM") );
EndPaint (hwnd, &ps) ;
return 0 ;
case WM_DESTROY :
PostQuitMessage(0);
return 0 ;
}
return DefWindowProc (hwnd, message, wParam, lParam) ;
}
c++如何使创建的窗口大小不可以改变的源代码
C++中当窗口大小改变的时候,系统就会发送一个WM_SIZE消息,如果你不想改变窗口的大小,就截获该消息并且不进行任何处理即可。
对于C++程序,你可以在消息处理函数这样写
LRESULT CALLBACK WindowProc(HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam){
switch(uMsg){
case WM_SIZE:
break;
}
对于MFC程序,你可以在响应WM_SIZE消息的消息处理函数中处理。
2024-12-22 09:40
2024-12-22 09:17
2024-12-22 08:56
2024-12-22 08:38
2024-12-22 08:29
2024-12-22 08:08