本文整理汇总了C++中SetWindowLongPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ SetWindowLongPtr函数的具体用法?C++ SetWindowLongPtr怎么用?C++ SetWindowLongPtr使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetWindowLongPtr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: JabberSearchAdvancedDlgProc
static INT_PTR CALLBACK JabberSearchAdvancedDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
JabberSearchData* dat = (JabberSearchData*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
dat = (JabberSearchData *)mir_calloc(sizeof(JabberSearchData));
dat->ppro = (CJabberProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)dat);
/* Server Combo box */
ptrA jud(dat->ppro->getStringA("Jud"));
char *szServerName = (jud == NULL) ? "users.jabber.org": jud;
SetDlgItemTextA(hwndDlg,IDC_SERVER,szServerName);
SendDlgItemMessageA(hwndDlg,IDC_SERVER,CB_ADDSTRING,0,(LPARAM)szServerName);
//TO DO: Add Transports here
int i, transpCount = dat->ppro->m_lstTransports.getCount();
for (i=0; i < transpCount; i++) {
TCHAR *szTransp = dat->ppro->m_lstTransports[i];
if (szTransp)
JabberSearchAddUrlToRecentCombo(hwndDlg, szTransp);
}
for (i=0; i < 10; i++) {
char key[30];
mir_snprintf(key, SIZEOF(key), "RecentlySearched_%d", i);
ptrT szValue( dat->ppro->getTStringA(key));
if (szValue != NULL)
JabberSearchAddUrlToRecentCombo(hwndDlg, szValue);
}
//TO DO: Add 4 recently used
dat->lastRequestIq = dat->ppro->SearchRenewFields(hwndDlg,dat);
}
return TRUE;
case WM_COMMAND:
if (LOWORD(wParam) == IDC_SERVER) {
switch (HIWORD(wParam)) {
case CBN_SETFOCUS:
PostMessage(GetParent(hwndDlg),WM_COMMAND, MAKEWPARAM(0,EN_SETFOCUS), (LPARAM)hwndDlg);
return TRUE;
case CBN_EDITCHANGE:
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
return TRUE;
case CBN_EDITUPDATE:
JabberSearchFreeData(hwndDlg, dat);
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
return TRUE;
case CBN_SELENDOK:
EnableWindow(GetDlgItem(hwndDlg, IDC_GO),TRUE);
PostMessage(hwndDlg,WM_COMMAND,MAKEWPARAM(IDC_GO,BN_CLICKED),0);
return TRUE;
}
}
else if (LOWORD(wParam) == IDC_GO && HIWORD(wParam) == BN_CLICKED) {
dat->ppro->SearchRenewFields(hwndDlg, dat);
return TRUE;
}
break;
case WM_SIZE:
{
//Resize IDC_FRAME to take full size
RECT rcForm;
GetWindowRect(hwndDlg, &rcForm);
RECT rcFrame;
GetWindowRect(GetDlgItem(hwndDlg, IDC_FRAME), &rcFrame);
rcFrame.bottom = rcForm.bottom;
SetWindowPos(GetDlgItem(hwndDlg,IDC_FRAME),NULL,0,0,rcFrame.right-rcFrame.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
GetWindowRect(GetDlgItem(hwndDlg,IDC_VSCROLL), &rcForm);
SetWindowPos(GetDlgItem(hwndDlg,IDC_VSCROLL),NULL,0,0,rcForm.right-rcForm.left,rcFrame.bottom-rcFrame.top,SWP_NOZORDER|SWP_NOMOVE);
JabberSearchRefreshFrameScroll(hwndDlg, dat);
}
return TRUE;
case WM_USER+11:
{
dat->fSearchRequestIsXForm=TRUE;
dat->xNode = (HXML)wParam;
JabberFormCreateUI(GetDlgItem(hwndDlg, IDC_FRAME), dat->xNode, &dat->CurrentHeight,TRUE);
ShowWindow(GetDlgItem(hwndDlg, IDC_FRAME), SW_SHOW);
dat->nJSInfCount=1;
return TRUE;
}
case WM_USER+10:
{
Data* MyDat = (Data*)lParam;
if (MyDat) {
dat->fSearchRequestIsXForm = (BOOL)wParam;
dat->CurrentHeight = JabberSearchAddField(hwndDlg,MyDat);
mir_free(MyDat->Label);
mir_free(MyDat->Var);
mir_free(MyDat->defValue);
free(MyDat);
}
//.........这里部分代码省略.........
示例2: WindowProc
LRESULT CALLBACK WindowProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
const int borderedge = 0; // 8;
const int topspace = 0;
static HWND hwndScintilla = 0;
HWND hWnd = 0;
char *szBuffer = 0;
RECT rect;
static UINT_PTR tid = 0;
switch (message)
{
case WM_INITDIALOG:
case WM_CREATE:
exitpending = false;
::GetClientRect(hwndDlg, &rect);
{
HMENU hMenu = (HMENU)::LoadMenu(ghModule, MAKEINTRESOURCE(IDR_CONSOLEMENU));
if (hMenu != INVALID_HANDLE_VALUE){
::SetMenu(hwndDlg, hMenu);
DWORD dw;
if (CRegistryUtils::GetRegDWORD(HKEY_CURRENT_USER, &dw, REGISTRY_KEY, REGISTRY_VALUE_CONSOLE_ON_TOP) && dw)
{
CheckMenuItem(
hMenu,
ID_CONSOLE_ALWAYSONTOP ,
MF_CHECKED
);
}
}
}
hwndScintilla = CreateWindowExA(0,
"Scintilla", "", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_CLIPCHILDREN,
borderedge,
borderedge + topspace,
rect.right - 2 * borderedge,
rect.bottom - 2 * borderedge - topspace,
hwndDlg, 0, ghModule, NULL);
if (hwndScintilla)
{
lpfnEditWndProc = (WNDPROC)SetWindowLongPtr(hwndScintilla, GWLP_WNDPROC, (LONG_PTR)SubClassProc);
::SetFocus(hwndScintilla);
fn = (sptr_t(__cdecl *)(sptr_t*, int, uptr_t, sptr_t))SendMessage(hwndScintilla, SCI_GETDIRECTFUNCTION, 0, 0);
ptr = (sptr_t*)SendMessage(hwndScintilla, SCI_GETDIRECTPOINTER, 0, 0);
char buffer[64];
DWORD dw;
fn(ptr, SCI_SETCODEPAGE, SC_CP_UTF8, 0);
SetConsoleDefaults();
fn(ptr, SCI_SETMARGINWIDTHN, 1, 0);
std::list< std::string > loglist;
getLogText(loglist);
for (std::list< std::string >::iterator iter = loglist.begin(); iter != loglist.end(); iter++)
{
if (!strncmp(iter->c_str(), DEFAULT_PROMPT, 2) || !strncmp(iter->c_str(), CONTINUATION_PROMPT, 2))
{
AppendLog(iter->c_str(), 0, 0);
}
else AppendLog(iter->c_str(), 1, 0);
}
Prompt();
//if (!wlInit)
initWordList();
tid = ::SetTimer(hwndDlg, TIMERID_FLUSHBUFFER, 1000, TimerProc);
}
else
{
DWORD dwErr = ::GetLastError();
char sz[64];
sprintf_s(sz, 64, "FAILED: 0x%x", dwErr);
OutputDebugStringA(sz);
::MessageBoxA(0, sz, "ERR", MB_OK);
EndDialog(hwndDlg, IDCANCEL);
return TRUE;
}
hWndConsole = hwndDlg;
if (rectConsole.right == rectConsole.left)
{
::SetWindowPos(hwndDlg, HWND_TOP, 0, 0, 600, 400, SWP_NOZORDER);
}
else
{
//.........这里部分代码省略.........
示例3: UserMembershipPageProc
INT_PTR CALLBACK
UserMembershipPageProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
PMEMBERSHIP_USER_DATA pUserData;
UNREFERENCED_PARAMETER(lParam);
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(hwndDlg);
pUserData= (PMEMBERSHIP_USER_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
switch (uMsg)
{
case WM_INITDIALOG:
pUserData = (PMEMBERSHIP_USER_DATA)HeapAlloc(GetProcessHeap(),
HEAP_ZERO_MEMORY,
sizeof(MEMBERSHIP_USER_DATA) +
lstrlen((LPTSTR)((PROPSHEETPAGE *)lParam)->lParam) * sizeof(TCHAR));
lstrcpy(pUserData->szUserName, (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
SetWindowLongPtr(hwndDlg, DWLP_USER, (INT_PTR)pUserData);
GetUserMembershipData(hwndDlg, pUserData);
break;
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_USER_MEMBERSHIP_ADD:
AddGroupToUser(hwndDlg, pUserData);
break;
case IDC_USER_MEMBERSHIP_REMOVE:
RemoveGroupFromUser(hwndDlg, pUserData);
break;
}
break;
case WM_NOTIFY:
if (((LPPSHNOTIFY)lParam)->hdr.code == PSN_APPLY)
{
return TRUE;
}
else
{
return OnNotify(hwndDlg, pUserData, lParam);
}
break;
case WM_DESTROY:
if (pUserData->pGroupData)
NetApiBufferFree(pUserData->pGroupData);
HeapFree(GetProcessHeap(), 0, pUserData);
break;
}
return FALSE;
}
示例4: LOWORD
BOOL WardShaderDlg::PanelProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam )
{
int id = LOWORD(wParam);
int code = HIWORD(wParam);
switch (msg) {
case WM_INITDIALOG:
{
int i;
HDC theHDC = GetDC(hwndDlg);
hOldPal = GetGPort()->PlugPalette(theHDC);
ReleaseDC(hwndDlg,theHDC);
for (i=0; i<WARD_NCOLBOX; i++) {
cs[i] = GetIColorSwatch(GetDlgItem(hwndDlg, colID[i]),
GetMtlColor(i, pShader), GetColorName(i));
}
hwHilite = GetDlgItem(hwndDlg, IDC_HIGHLIGHT);
SetWindowLongPtr( hwHilite, GWLP_WNDPROC, (LONG_PTR)Hilite2WndProc);
slevSpin = SetupIntSpinner(hwndDlg, IDC_SLEV_SPIN, IDC_SLEV_EDIT, 0,400, 0);
dlevSpin = SetupIntSpinner(hwndDlg, IDC_DLEV_SPIN, IDC_DLEV_EDIT, 0, 400, 0);
glxSpin = SetupIntSpinner(hwndDlg, IDC_GLX_SPIN, IDC_GLX_EDIT, 0,100, 0);
glySpin = SetupIntSpinner(hwndDlg, IDC_GLY_SPIN, IDC_GLY_EDIT, 0,100, 0);
trSpin = SetupIntSpinner(hwndDlg, IDC_TR_SPIN, IDC_TR_EDIT, 0,100, 0);
for (int j=0; j<NMBUTS; j++) {
texMBut[j] = GetICustButton(GetDlgItem(hwndDlg,texMButtonsIDC[j]));
assert( texMBut[j] );
texMBut[j]->SetRightClickNotify(TRUE);
texMBut[j]->SetDADMgr(&dadMgr);
}
SetupLockButton(hwndDlg,IDC_LOCK_AD,FALSE);
SetupLockButton(hwndDlg,IDC_LOCK_DS,FALSE);
SetupPadLockButton(hwndDlg,IDC_LOCK_ADTEX, TRUE);
LoadDialog(TRUE);
}
break;
case WM_COMMAND:
{
for ( int i=0; i<NMBUTS; i++) {
if (id == texMButtonsIDC[i]) {
PostMessage(hwmEdit,WM_TEXMAP_BUTTON, texmapFromMBut[i],(LPARAM)pMtl );
UpdateMapButtons();
goto exit;
}
}
}
switch (id) {
case IDC_NORMALIZE_CHECK:
pShader->SetNormalizeOn( ! GetCheckBox(hwndDlg, IDC_NORMALIZE_CHECK) );
UpdateHilite();
NotifyChanged();
UpdateMtlDisplay();
break;
case IDC_LOCK_AD:
SetLockAD(IsButtonChecked(hwndDlg, IDC_LOCK_AD));
UpdateMtlDisplay();
break;
case IDC_LOCK_DS:
SetLockDS(IsButtonChecked(hwndDlg, IDC_LOCK_DS));
UpdateMtlDisplay();
break;
case IDC_LOCK_ADTEX:{
BOOL on = IsButtonChecked(hwndDlg, IDC_LOCK_ADTEX);
SetLockADTex(on);
UpdateMtlDisplay();
} break;
}
break;
case CC_COLOR_SEL: {
int id = LOWORD(wParam);
SelectEditColor(ColorIDCToIndex(id));
}
break;
case CC_COLOR_DROP: {
int id = LOWORD(wParam);
SelectEditColor(ColorIDCToIndex(id));
UpdateMtlDisplay();
}
break;
case CC_COLOR_BUTTONDOWN:
theHold.Begin();
break;
case CC_COLOR_BUTTONUP:
if (HIWORD(wParam)) theHold.Accept(GetString(IDS_DS_PARAMCHG));
else theHold.Cancel();
UpdateMtlDisplay();
break;
case CC_COLOR_CHANGE: {
int id = LOWORD(wParam);
int buttonUp = HIWORD(wParam);
//.........这里部分代码省略.........
示例5: PropPageDlgProc
INT_PTR
PropPageDlgProc(_In_ HWND hDlg,
_In_ UINT uMessage,
_In_ WPARAM wParam,
_In_ LPARAM lParam)
/*++
Routine Description: PropPageDlgProc
The windows control function for the custom property page window
Arguments:
hDlg, uMessage, wParam, lParam: standard windows DlgProc parameters
Return Value:
BOOL: FALSE if function fails, TRUE if function passes
--*/
{
PTOASTER_PROP_PARAMS params;
UNREFERENCED_PARAMETER( wParam );
params = (PTOASTER_PROP_PARAMS) GetWindowLongPtr(hDlg, DWLP_USER);
switch(uMessage) {
case WM_COMMAND:
break;
case WM_CONTEXTMENU:
break;
case WM_HELP:
break;
case WM_INITDIALOG:
//
// on WM_INITDIALOG call, lParam points to the property
// sheet page.
//
// The lParam field in the property sheet page struct is set by the
// caller. This was set when we created the property sheet.
// Save this in the user window long so that we can access it on later
// on later messages.
//
params = (PTOASTER_PROP_PARAMS) ((LPPROPSHEETPAGE)lParam)->lParam;
SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR) params);
break;
case WM_NOTIFY:
OnNotify(hDlg, (NMHDR *)lParam, params);
break;
default:
return FALSE;
}
return TRUE;
}
示例6: wndProc
static LRESULT CALLBACK wndProc(HWND wnd, UINT message,
WPARAM wParam, LPARAM lParam)
{
int useDefWindowProc = 0;
JNIEnv *env = NULL;
jobject window = NULL;
BOOL isKeyDown = FALSE;
WindowUserData * wud;
#if defined(UNDER_CE) || _MSC_VER <= 1200
wud = (WindowUserData *) GetWindowLong(wnd, GWL_USERDATA);
#else
wud = (WindowUserData *) GetWindowLongPtr(wnd, GWLP_USERDATA);
#endif
if(NULL==wud) {
return DefWindowProc(wnd, message, wParam, lParam);
}
env = wud->jenv;
window = wud->jinstance;
if (NULL==window || NULL==env) {
return DefWindowProc(wnd, message, wParam, lParam);
}
// DBG_PRINT("*** WindowsWindow: window %p -> %p, 0x%X %d/%d\n", wnd, window, message, (int)LOWORD(lParam), (int)HIWORD(lParam));
switch (message) {
//
// The signal pipeline for destruction is:
// Java::DestroyWindow(wnd) _or_ window-close-button ->
// WM_CLOSE -> Java::windowDestroyNotify -> W_DESTROY -> Java::windowDestroyed ->
// Java::CleanupWindowResources()
case WM_CLOSE:
(*env)->CallVoidMethod(env, window, windowDestroyNotifyID);
break;
case WM_DESTROY:
{
#if defined(UNDER_CE) || _MSC_VER <= 1200
SetWindowLong(wnd, GWL_USERDATA, (intptr_t) NULL);
#else
SetWindowLongPtr(wnd, GWLP_USERDATA, (intptr_t) NULL);
#endif
free(wud); wud=NULL;
(*env)->CallVoidMethod(env, window, windowDestroyedID);
(*env)->DeleteGlobalRef(env, window);
}
break;
case WM_SYSCHAR:
useDefWindowProc = WmChar(env, window, wParam,
LOWORD(lParam), HIWORD(lParam), FALSE);
break;
case WM_CHAR:
useDefWindowProc = WmChar(env, window, wParam,
LOWORD(lParam), HIWORD(lParam), TRUE);
break;
case WM_KEYDOWN:
useDefWindowProc = WmKeyDown(env, window, wParam,
LOWORD(lParam), HIWORD(lParam), FALSE);
break;
case WM_KEYUP:
useDefWindowProc = WmKeyUp(env, window, wParam,
LOWORD(lParam), HIWORD(lParam), FALSE);
break;
case WM_SIZE:
WmSize(env, wnd, window, (UINT)wParam);
break;
case WM_SETTINGCHANGE:
if (wParam == SPI_SETNONCLIENTMETRICS) {
// make sure insets are updated, we don't need to resize the window
// because the size of the client area doesn't change
(void)UpdateInsets(env, wnd, window);
} else {
useDefWindowProc = 1;
}
break;
case WM_LBUTTONDOWN:
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_PRESSED,
GetModifiers(),
(jint) LOWORD(lParam), (jint) HIWORD(lParam),
(jint) 1, (jint) 0);
useDefWindowProc = 1;
break;
case WM_LBUTTONUP:
(*env)->CallVoidMethod(env, window, sendMouseEventID,
(jint) EVENT_MOUSE_RELEASED,
GetModifiers(),
(jint) LOWORD(lParam), (jint) HIWORD(lParam),
(jint) 1, (jint) 0);
//.........这里部分代码省略.........
示例7: Point
BOOL GLWindow::createGLWindow(char* title, WNDPROC WndProc)
{
WNDCLASS wc;
DWORD dwExStyle;
DWORD dwStyle;
RECT WindowRect;
int width = isFullscreen?videoModes[fullscreenMode].width:videoModes[windowedMode].width;
int height = isFullscreen?videoModes[fullscreenMode].height:videoModes[windowedMode].height;
int bits = isFullscreen?videoModes[fullscreenMode].bpp:videoModes[windowedMode].bpp;
windowPosition = Point(nativeMode.dmPelsWidth/2 - width/2, nativeMode.dmPelsHeight/2 - height/2);
int x = isFullscreen?0:windowPosition.x;
int y = isFullscreen?0:windowPosition.y;
WindowRect.left = (long) x;
WindowRect.right = (long) x + width;
WindowRect.top = (long) y;
WindowRect.bottom = (long) y + height;
hInstance = GetModuleHandle(NULL);
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = NULL;
wc.lpszClassName = __TEXT("OGL");
RegisterClass(&wc);
if (isFullscreen)
{
DEVMODE dm;
memset(&dm,0,sizeof(dm));
dm.dmSize=sizeof(dm);
dm.dmPelsWidth = width;
dm.dmPelsHeight = height;
dm.dmBitsPerPel = bits;
dm.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
ChangeDisplaySettings(&dm,CDS_FULLSCREEN);
dwExStyle = WS_EX_APPWINDOW;
dwStyle = WS_POPUP;
}
else
{
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE;
}
AdjustWindowRectEx(&WindowRect, dwStyle, false, dwExStyle);
HMENU hMenu;
hMenu = LoadMenu(hInstance, MAKEINTRESOURCE(ID_MENU));
HBRUSH hBrush = CreateSolidBrush(RGB(150, 150, 150));
MENUINFO mi = { 0 };
mi.cbSize = sizeof(mi);
mi.fMask = MIM_BACKGROUND|MIM_APPLYTOSUBMENUS;
mi.hbrBack = hBrush;
SetMenuInfo(hMenu, &mi);
hWnd=CreateWindowEx( dwExStyle,
__TEXT("OGL"),
title,
dwStyle |
WS_CLIPSIBLINGS |
WS_CLIPCHILDREN,
WindowRect.left, WindowRect.top,
WindowRect.right-WindowRect.left,
WindowRect.bottom-WindowRect.top,
NULL,
hMenu,
hInstance,
NULL);
if(!isFullscreen)
{
dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
dwStyle = WS_OVERLAPPEDWINDOW | WS_MINIMIZEBOX | WS_SYSMENU | WS_VISIBLE;
SetWindowLongPtr(hWnd, GWL_EXSTYLE, dwExStyle);
SetWindowLongPtr(hWnd, GWL_STYLE, dwStyle);
}
SetWindowTheme(hWnd, L" ", L" ");
RECT rcClient,rcWind;
GetClientRect(hWnd, &rcClient);
GetWindowRect(hWnd, &rcWind);
borderWidth = 2*((rcWind.right - rcWind.left) - rcClient.right)/2;
borderHeight = 2*((rcWind.bottom - rcWind.top) - rcClient.bottom)/2;
initGL(bits);
SetForegroundWindow(hWnd);
SetFocus(hWnd);
//.........这里部分代码省略.........
示例8: SetWindowLongPtr
LRESULT WINAPI container_window::window_proc(HWND wnd,UINT msg,WPARAM wp,LPARAM lp)
{
container_window * p_this;
if(msg == WM_NCCREATE)
{
LPVOID * create_params = reinterpret_cast<LPVOID *>(((CREATESTRUCT *)(lp))->lpCreateParams);
p_this = reinterpret_cast<container_window *>(create_params[0]); //retrieve pointer to class
SetWindowLongPtr(wnd, GWL_USERDATA, (LPARAM)p_this);//store it for future use
if (p_this)
{
p_this->get_class_data().refcount++;
p_this->wnd_host = wnd;
}
}
else
p_this = reinterpret_cast<container_window*>(GetWindowLongPtr(wnd,GWL_USERDATA));//if isnt wm_nccreate, retrieve pointer to class
if (msg == WM_NCDESTROY)
{
if (p_this)
{
p_this->get_class_data().refcount--;
p_this->wnd_host = NULL;
}
}
if (p_this && p_this->get_class_data().want_transparent_background)
{
if (msg == WM_ERASEBKGND)
{
HDC dc = (HDC)wp;
HWND wnd_parent = GetParent(wnd);
POINT pt = {0, 0}, pt_old = {0,0};
MapWindowPoints(wnd, wnd_parent, &pt, 1);
OffsetWindowOrgEx(dc, pt.x, pt.y, &pt_old);
BOOL b_ret = SendMessage(wnd_parent, WM_ERASEBKGND,wp, 0);
SetWindowOrgEx(dc, pt_old.x, pt_old.y, 0);
return b_ret;
}
else if (msg==WM_MOVE || msg==WM_SIZE)
{
RedrawWindow(wnd, 0, 0, RDW_ERASE|RDW_INVALIDATE|RDW_ALLCHILDREN);
}
}
if ( msg == WM_SETTINGCHANGE && p_this && p_this->get_class_data().forward_system_settings_change)
{
win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
}
else if ( msg == WM_SYSCOLORCHANGE && p_this && p_this->get_class_data().forward_system_colours_change)
{
win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
}
else if ( msg == WM_TIMECHANGE && p_this && p_this->get_class_data().forward_system_time_change)
{
win32_helpers::send_message_to_direct_children(wnd, msg, wp, lp);
}
return p_this ? p_this->on_message(wnd, msg, wp, lp) : uDefWindowProc(wnd, msg, wp, lp);
}
示例9: GetNullTerminatedStringChars
/*
* Class: com_sun_javafx_newt_windows_WindowsWindow
* Method: CreateWindow
* Signature: (JILjava/lang/String;JJZIIII)J
*/
JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_windows_WindowsWindow_CreateWindow
(JNIEnv *env, jobject obj, jlong parent, jint wndClassAtom, jstring jWndName, jlong hInstance, jlong visualID,
jboolean bIsUndecorated,
jint jx, jint jy, jint defaultWidth, jint defaultHeight)
{
HWND parentWindow = (HWND) (intptr_t) parent;
const TCHAR* wndName = NULL;
DWORD windowStyle = WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE;
int x=(int)jx, y=(int)jy;
int width=(int)defaultWidth, height=(int)defaultHeight;
HWND window = NULL;
#ifdef UNICODE
wndName = GetNullTerminatedStringChars(env, jWndName);
#else
wndName = (*env)->GetStringUTFChars(env, jWndName, NULL);
#endif
if(NULL!=parentWindow) {
windowStyle |= WS_CHILD ;
} else if (bIsUndecorated) {
windowStyle |= WS_POPUP | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX;
} else {
windowStyle |= WS_OVERLAPPEDWINDOW;
x = CW_USEDEFAULT;
y = 0;
}
(void) visualID; // FIXME: use the visualID ..
window = CreateWindow(MAKEINTATOM(wndClassAtom), wndName, windowStyle,
x, y, width, height,
parentWindow, NULL,
(HINSTANCE) (intptr_t) hInstance,
NULL);
DBG_PRINT("*** WindowsWindow: CreateWindow parent %p, window %p, %d/%d %dx%d\n", parentWindow, window, x, y, width, height);
if (NULL != window) {
WindowUserData * wud = (WindowUserData *) malloc(sizeof(WindowUserData));
wud->jinstance = (*env)->NewGlobalRef(env, obj);
wud->jenv = env;
#if defined(UNDER_CE) || _MSC_VER <= 1200
SetWindowLong(window, GWL_USERDATA, (intptr_t) wud);
#else
SetWindowLongPtr(window, GWLP_USERDATA, (intptr_t) wud);
#endif
UpdateInsets(env, window, obj);
ShowWindow(window, SW_SHOWNORMAL);
}
#ifdef UNICODE
free((void*) wndName);
#else
(*env)->ReleaseStringUTFChars(env, jWndName, wndName);
#endif
return (jlong) (intptr_t) window;
}
示例10: switch
INT_PTR CALLBACK CVkProto::OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
ppro = (CVkProto*)lParam;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
{
ptrT tszLogin(ppro->getTStringA("Login"));
if (tszLogin != NULL)
SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
ptrT tszPassw(ppro->GetUserStoredPassword());
if (tszPassw != NULL)
SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
SetDlgItemText(hwndDlg, IDC_GROUPNAME, ppro->getGroup());
}
CheckDlgButton(hwndDlg, IDC_DELIVERY, ppro->m_bServerDelivery);
CheckDlgButton(hwndDlg, IDC_HIDECHATS, ppro->m_bHideChats);
CheckDlgButton(hwndDlg, IDC_AUTOCLEAN, ppro->getByte("AutoClean", 0));
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_URL:
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
break;
case IDC_LOGIN:
case IDC_PASSWORD:
case IDC_GROUPNAME:
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_DELIVERY:
case IDC_HIDECHATS:
case IDC_AUTOCLEAN:
if (HIWORD(wParam) == BN_CLICKED && (HWND)lParam == GetFocus())
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
break;
case WM_NOTIFY:
if (((LPNMHDR)lParam)->code == PSN_APPLY) {
TCHAR str[128];
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
ppro->setTString("Login", str);
GetDlgItemText(hwndDlg, IDC_GROUPNAME, str, SIZEOF(str));
if (_tcscmp(ppro->getGroup(), str)) {
ppro->setGroup(str);
ppro->setTString("ProtoGroup", str);
}
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
ptrA szRawPasswd(mir_utf8encodeT(str));
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
ppro->m_bServerDelivery = IsDlgButtonChecked(hwndDlg, IDC_DELIVERY) == BST_CHECKED;
ppro->setByte("ServerDelivery", ppro->m_bServerDelivery);
ppro->m_bHideChats = IsDlgButtonChecked(hwndDlg, IDC_HIDECHATS) == BST_CHECKED;
ppro->setByte("HideChats", ppro->m_bHideChats);
ppro->setByte("AutoClean", IsDlgButtonChecked(hwndDlg, IDC_AUTOCLEAN) == BST_CHECKED);
}
break;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
case WM_DESTROY:
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
break;
}
return FALSE;
}
示例11: VKAccountProc
INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CVkProto *ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
ppro = (CVkProto*)lParam;
SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
{
ptrT tszLogin(ppro->getTStringA("Login"));
if (tszLogin != NULL)
SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
ptrT tszPassw(ppro->GetUserStoredPassword());
if (tszPassw != NULL)
SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
}
return TRUE;
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_URL:
CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
break;
case IDC_LOGIN:
case IDC_PASSWORD:
if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
}
}
break;
case WM_NOTIFY:
switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
TCHAR str[128];
GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
ppro->setTString("Login", str);
GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
ptrA szRawPasswd( mir_utf8encodeT(str));
if (szRawPasswd != NULL)
ppro->setString("Password", szRawPasswd);
}
break;
case WM_CLOSE:
EndDialog(hwndDlg, 0);
break;
case WM_DESTROY:
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
break;
}
return FALSE;
}
示例12: CardBackDlgProc
INT_PTR CALLBACK CardBackDlgProc(HWND hDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
static PCARDBACK pCardBacks = NULL;
switch (uMsg)
{
case WM_INITDIALOG:
{
INT i, c;
SIZE_T size = sizeof(CARDBACK) * NUM_CARDBACKS;
pCardBacks = (PCARDBACK)HeapAlloc(GetProcessHeap(),
0,
size);
for (i = 0, c = CARDBACK_START; c <= CARDBACK_END; i++, c++)
{
pCardBacks[i].hSelf = GetDlgItem(hDlg, c);
pCardBacks[i].bSelected = FALSE;
pCardBacks[i].hdcNum = CARDBACK_RES_START + i;
pCardBacks[i].imgNum = i + 1;
pCardBacks[i].hOldProc = (WNDPROC)SetWindowLongPtr(pCardBacks[i].hSelf,
GWLP_WNDPROC,
(LONG_PTR)CardImageWndProc);
SetWindowLongPtr(pCardBacks[i].hSelf,
GWL_USERDATA,
(LONG_PTR)&pCardBacks[i]);
}
return TRUE;
}
case WM_COMMAND:
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
{
INT i, num = 0;
for (i = 0; i < NUM_CARDBACKS; i++)
{
if (pCardBacks[i].bSelected)
{
num = pCardBacks[i].imgNum;
}
}
EndDialog(hDlg, LOWORD(wParam) == IDOK ? num : FALSE);
HeapFree(GetProcessHeap(), 0, pCardBacks);
return TRUE;
}
if (HIWORD(wParam) == STN_CLICKED)
{
INT i;
RECT rc;
for (i = 0; i < NUM_CARDBACKS; i++)
{
if (pCardBacks[i].hSelf == (HWND)lParam)
{
pCardBacks[i].bSelected = TRUE;
}
else
pCardBacks[i].bSelected = FALSE;
GetClientRect(pCardBacks[i].hSelf, &rc);
InvalidateRect(pCardBacks[i].hSelf, &rc, TRUE);
}
break;
}
}
return FALSE;
}
示例13: SetLastError
LRESULT CALLBACK CMSPThread::NotifWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
PNOTIF_LIST pnl;
if (uMsg == WM_CREATE)
{
SetLastError(0);
if (!SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR)(((LPCREATESTRUCT)lParam)->lpCreateParams)))
{
if (GetLastError()) // It isn't really an error unless get last error says so
{
LOG((MSP_ERROR, "CMSPThread::NotifWndProc - SetWindowLongPtr failed %ld", GetLastError()));
_ASSERTE(FALSE);
return -1;
}
}
}
else
{
CMSPThread *me = (CMSPThread*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
switch (uMsg)
{
case WM_DEVICECHANGE:
switch(wParam)
{
case DBT_DEVICEARRIVAL:
LOG((MSP_TRACE, "CMSPThread::NotifWndProc - DBT_DEVICEARRIVAL"));
me->m_NotifLock.Lock();
pnl = me->m_NotifList;
while (pnl != NULL)
{
pnl->addr->PnpNotifHandler(TRUE);
pnl = pnl->next;
}
me->m_NotifLock.Unlock();
break;
case DBT_DEVICEREMOVECOMPLETE:
LOG((MSP_TRACE, "CMSPThread::NotifWndProc - DBT_DEVICEREMOVECOMPLETE"));
me->m_NotifLock.Lock();
pnl = me->m_NotifList;
while (pnl != NULL)
{
pnl->addr->PnpNotifHandler(FALSE);
pnl = pnl->next;
}
me->m_NotifLock.Unlock();
break;
}
return 0;
case WM_DESTROY:
return 0;
default:
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
}
return 0;
}
示例14: wf_post_connect
boolean wf_post_connect(freerdp* instance)
{
rdpGdi* gdi;
wfInfo* wfi;
rdpCache* cache;
wfContext* context;
int width, height;
wchar_t win_title[64];
rdpSettings* settings;
settings = instance->settings;
context = (wfContext*) instance->context;
cache = instance->context->cache;
wfi = context->wfi;
wfi->dstBpp = 32;
width = settings->width;
height = settings->height;
if (wfi->sw_gdi)
{
gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
gdi = instance->context->gdi;
wfi->hdc = gdi->primary->hdc;
wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, gdi->primary_buffer);
rfx_context_set_cpu_opt(gdi->rfx_context, wfi_detect_cpu());
}
else
{
wf_gdi_register_update_callbacks(instance->update);
wfi->srcBpp = instance->settings->color_depth;
wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, NULL);
wfi->hdc = gdi_GetDC();
wfi->hdc->bitsPerPixel = wfi->dstBpp;
wfi->hdc->bytesPerPixel = wfi->dstBpp / 8;
wfi->hdc->alpha = wfi->clrconv->alpha;
wfi->hdc->invert = wfi->clrconv->invert;
wfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
wfi->hdc->hwnd->invalid->null = 1;
wfi->hdc->hwnd->count = 32;
wfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count);
wfi->hdc->hwnd->ninvalid = 0;
wfi->image = wf_bitmap_new(wfi, 64, 64, 32, NULL);
wfi->image->_bitmap.data = NULL;
if (settings->rfx_codec)
{
wfi->tile = wf_bitmap_new(wfi, 64, 64, 24, NULL);
wfi->rfx_context = rfx_context_new();
rfx_context_set_cpu_opt(wfi->rfx_context, wfi_detect_cpu());
}
if (settings->ns_codec)
wfi->nsc_context = nsc_context_new();
}
if (settings->window_title != NULL)
_snwprintf(win_title, sizeof(win_title), L"%S", settings->window_title);
else if (settings->port == 3389)
_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"FreeRDP: %S", settings->hostname);
else
_snwprintf(win_title, sizeof(win_title) / sizeof(win_title[0]), L"FreeRDP: %S:%d", settings->hostname, settings->port);
if (wfi->hwnd == 0)
{
wfi->hwnd = CreateWindowEx((DWORD) NULL, g_wnd_class_name, win_title,
0, 0, 0, 0, 0, NULL, NULL, g_hInstance, NULL);
SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi);
}
if (wfi->fullscreen)
{
SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_POPUP);
SetWindowPos(wfi->hwnd, HWND_TOP, 0, 0, width, height, SWP_FRAMECHANGED);
}
else
{
POINT diff;
RECT rc_client, rc_wnd;
SetWindowLongPtr(wfi->hwnd, GWL_STYLE, WS_CAPTION | WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX);
/* Now resize to get full canvas size and room for caption and borders */
SetWindowPos(wfi->hwnd, HWND_TOP, 10, 10, width, height, SWP_FRAMECHANGED);
GetClientRect(wfi->hwnd, &rc_client);
GetWindowRect(wfi->hwnd, &rc_wnd);
diff.x = (rc_wnd.right - rc_wnd.left) - rc_client.right;
diff.y = (rc_wnd.bottom - rc_wnd.top) - rc_client.bottom;
SetWindowPos(wfi->hwnd, HWND_TOP, -1, -1, width + diff.x, height + diff.y, SWP_NOMOVE | SWP_FRAMECHANGED);
}
BitBlt(wfi->primary->hdc, 0, 0, width, height, NULL, 0, 0, BLACKNESS);
wfi->drawing = wfi->primary;
//.........这里部分代码省略.........
示例15: ReadAwayMsgDlgProc
static INT_PTR CALLBACK ReadAwayMsgDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
{
HICON hTitleIcon = Skin_LoadIcon(SKINICON_OTHER_MIRANDA);
SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hTitleIcon);
SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon);
Utils_RestoreWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING);
READAWAYMSGDATA *awayData = new READAWAYMSGDATA;
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)awayData);
awayData->hContact = lParam;
awayData->hAwayMsgEvent = HookEventMessage(ME_PROTO_ACK, hwndDlg, UM_RAM_AWAYMSGACK);
awayData->hSeq = (HANDLE)CallContactService(awayData->hContact, PSS_GETAWAYMSG, 0, 0);
WindowList_Add(g_hReadWndList, hwndDlg, awayData->hContact);
TCHAR str[256], format[128];
TCHAR *contactName = pcli->pfnGetContactDisplayName(awayData->hContact, 0);
char *szProto = GetContactProto(awayData->hContact);
TCHAR *status = pcli->pfnGetStatusModeDescription(db_get_w(awayData->hContact, szProto, "Status", ID_STATUS_OFFLINE), 0);
GetWindowText(hwndDlg, format, _countof(format));
mir_sntprintf(str, _countof(str), format, status, contactName);
SetWindowText(hwndDlg, str);
GetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, format, _countof(format));
mir_sntprintf(str, _countof(str), format, status);
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_RETRIEVE, str);
}
return true;
case UM_RAM_AWAYMSGACK: // got away msg
{
ACKDATA *ack = (ACKDATA*)lParam;
READAWAYMSGDATA *awayData = (READAWAYMSGDATA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
// make sure everything is ok, and this is our ack
if (ack->hContact != awayData->hContact || ack->type != ACKTYPE_AWAYMSG || ack->hProcess != awayData->hSeq || ack->result != ACKRESULT_SUCCESS)
break;
// done with the event
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
awayData->hAwayMsgEvent = NULL;
}
const TCHAR *ptszStatusMsg = (const TCHAR*)ack->lParam;
SetDlgItemText(hwndDlg, IDC_READAWAYMSG_MSG, ptszStatusMsg);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_RETRIEVE), SW_HIDE);
ShowWindow(GetDlgItem(hwndDlg, IDC_READAWAYMSG_MSG), SW_SHOW);
SetDlgItemText(hwndDlg, IDOK, TranslateT("&Close"));
db_set_ts(awayData->hContact, "CList", "StatusMsg", ptszStatusMsg);
}
break;
case WM_COMMAND:
switch (HIWORD(wParam)) {
case BN_CLICKED:
switch (LOWORD(wParam)) {
case IDCANCEL:
case IDOK:
DestroyWindow(hwndDlg);
break;
}
}
break;
case WM_SIZE:
Utils_ResizeDialog(hwndDlg, g_hInstance, MAKEINTRESOURCEA(IDD_READAWAYMSG), ReadAwayMsgDlgResize);
break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
break;
case WM_DESTROY:
READAWAYMSGDATA *awayData = (READAWAYMSGDATA*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (awayData->hAwayMsgEvent) {
UnhookEvent(awayData->hAwayMsgEvent);
awayData->hAwayMsgEvent = NULL;
}
delete awayData;
Utils_SaveWindowPosition(hwndDlg, NULL, MOD_NAME, RAMDLGSIZESETTING);
WindowList_Remove(g_hReadWndList, hwndDlg);
}
return false;
}