锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品18久久久久久,久久99国产精品久久99果冻传媒,97久久婷婷五月综合色d啪蜜芽http://www.shnenglu.com/gohan/category/4394.htmlzh-cnFri, 27 Jun 2008 18:31:22 GMTFri, 27 Jun 2008 18:31:22 GMT60鍚慥ista瀛︿範錛屽疄鐜癤P涓嬮噸鍛藉悕鏂囦歡蹇界暐閫夊彇鎵╁睍鍚?/title><link>http://www.shnenglu.com/gohan/archive/2008/05/17/50122.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Fri, 16 May 2008 18:05:00 GMT</pubDate><guid>http://www.shnenglu.com/gohan/archive/2008/05/17/50122.html</guid><wfw:comment>http://www.shnenglu.com/gohan/comments/50122.html</wfw:comment><comments>http://www.shnenglu.com/gohan/archive/2008/05/17/50122.html#Feedback</comments><slash:comments>12</slash:comments><wfw:commentRss>http://www.shnenglu.com/gohan/comments/commentRss/50122.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gohan/services/trackbacks/50122.html</trackback:ping><description><![CDATA[<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="129" alt="image" src="http://www.shnenglu.com/images/cppblog_com/gohan/WindowsLiveWriter/VistaXP_105A/image_1bf4b754-9e02-4945-9552-b70650bc5dbe.png" width="124" align="right" border="0">   榪欎袱澶╁浜嶩OOK鐨勬妧鏈湁浜嗕竴涓叆闂ㄧ殑瀛︿範錛岀敤榪噕ista鐨勫悓瀛︿細鍙戠幇vista閲嶅懡鍚嶄竴涓枃浠舵瘮濡倂ista.exe錛屼粬浼氳嚜鍔ㄩ変腑vista蹇界暐鎺夋墿灞曞悕錛屽甫鏉ユ瘮杈冩柟渚跨殑鐢ㄦ埛浣撻獙錛屽浜嗕竴浜沨ook鎴戜篃鎯寵瘯璇晉p涓嬭兘涓嶈兘鍋氳繖鏍風殑浜嬫儏銆備簬鏄弬鑰冧竴浜涙枃绔狅紝鍕夊己瀹炵幇浜嗭紝鏈変竴鐐瑰効緙洪櫡錛堣鐪嬫渶鍚庯級銆?/p> <p>   緇忚繃瑙傚療鎴戝彂鐜伴噸鍛藉悕鏃訛紝璧勬簮綆$悊鍣ㄤ細鍚戜粬鐨勫瓙紿楀彛listview鍙戦佷竴涓狶VM_EDITLABELA鐨勬帶鍒舵秷鎭紝鎵浠ユ垜浣跨敤浜哤H_CALLWNDPROCRET綾誨瀷鐨勫叏灞鎸傞挬錛岃繖涓寕閽╁彲浠ュ湪sendmessage緇撴潫浠ュ悗澶勭悊浼犻佸拰榪斿洖鐨勬暟鎹傚彂閫佷簡LVM_EDITLABELA娑堟伅鍚庯紝浼氬湪lParam寰楀埌涓涓紪杈戠獥鍙g殑鍙ユ焺錛屽彧闇涔嬪悗瀵硅繖涓獥鍙e彂閫丒M_SETSEL鎺у埗娑堟伅灝辮兘澶熸敼鍙橀噸鍛藉悕鏃跺欑殑楂樹寒鍖哄煙銆俬ook鍥炶皟鍑芥暟濡備笅錛?/p> <div style="border-right: gray 1px solid; padding-right: 4px; border-top: gray 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: gray 1px solid; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; padding-top: 4px; border-bottom: gray 1px solid; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4"> <div style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 1:</span> <span style="color: #0000ff">static</span> LRESULT CALLBACK msghook(UINT nCode, WPARAM wParam, LPARAM lParam)</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 2:</span> {</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 3:</span> <span style="color: #0000ff">if</span>(nCode < 0)</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 4:</span> {</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 5:</span> CallNextHookEx(hook,nCode,wParam,lParam);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 6:</span> <span style="color: #0000ff">return</span> 0;</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 7:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 8:</span> LPCWPRETSTRUCT msg = (LPCWPRETSTRUCT) lParam;</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 9:</span> <span style="color: #0000ff">if</span>(msg->message == LVM_EDITLABELA || msg->message == LVM_EDITLABELW)</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 10:</span> {</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 11:</span> GetClassName(msg->hwnd,className,255);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 12:</span> GetWindowText(msg->hwnd,wndName,255);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 13:</span> <span style="color: #0000ff">if</span>(0==_tcscmp(className,_TEXT(<span style="color: #006080">"SysListView32"</span>)))</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 14:</span> {</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 15:</span> <span style="color: #0000ff">if</span>(0==_tcscmp(wndName,_TEXT(<span style="color: #006080">"FolderView"</span>)))</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 16:</span> {</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 17:</span> hEditWnd = (HWND)msg->lResult;</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 18:</span> GetWindowText(hEditWnd,className,255);<span style="color: #008000">//鏆傛椂鏀懼叆className</span></pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 19:</span> SendMessage(hEditWnd,EM_SETSEL,0,findDot(className));</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 20:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 21:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 22:</span> }</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: white; border-bottom-style: none"><span style="color: #606060"> 23:</span> <span style="color: #0000ff">return</span> CallNextHookEx(hook,nCode,wParam,lParam);</pre><pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: consolas,'Courier New',courier,monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; border-bottom-style: none"><span style="color: #606060"> 24:</span> }</pre></div></div> <p> </p> <p>className涓巜ndName鏄袱涓猅CHAR鏁扮粍錛屼粠hwnd鑾峰彇淇℃伅瀛樺湪閭i噷榪涜鍒ゆ柇鏄惁涓篠hell涓殑listview錛岄伩鍏嶅湪鍏跺畠浣跨敤listview鐨勫簲鐢ㄧ▼搴忛噷浼氳繘琛屼箣鍚庣殑澶勭悊銆?/p> <p>   宸ョ▼鏂囦歡涓嬭澆錛?a href="http://www.shnenglu.com/Files/gohan/HookDemoSrc.rar" target="_blank">鐐硅繖閲?/a></p> <p>   紼嬪簭涓嬭澆錛?a href="http://www.shnenglu.com/Files/gohan/GRenamer.rar" target="_blank">鐐硅繖閲?/a></p> <p>   浣跨敤鏂規硶錛岀紪璇戜互鍚庣洿鎺ヨ繍琛孏Rnamer灝卞彲浠ワ紝濡傛灉涓嶆兂鐢ㄤ簡錛屼粠浠誨姟綆$悊鍣ㄦ妸瀹冨叧闂紝娌℃湁鍋歵rayicon涔嬬被鐨勪笢瑗匡紝鍥犱負鍙槸涓猟emo銆?/p> <p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="48" alt="image" src="http://www.shnenglu.com/images/cppblog_com/gohan/WindowsLiveWriter/VistaXP_105A/image_11463743-357a-4d42-ac50-b9eeb0b9fa1d.png" width="165" align="left" border="0">   鏈鍚庤涓涓嬬己闄鳳紝緙洪櫡灝辨槸榪欐牱鍋氭病鏈夊姙娉曞垽鏂枃浠朵笌鏂囦歡澶圭殑鍖哄埆錛屾墍浠ヤ細鏈夊鍥劇殑鏁堟灉錛屾垜鑷繁娌℃湁鎯沖埌瑙e喅鐨勬柟娉曪紝璇瘋揪浜轟滑鎸囩偣銆傦細錛?</p> <p> </p> <p>   鍙傝冪殑鏂囩珷錛?/p> <p><a target="_blank">msdn Hooks</a> hook鐨勫叏閮ㄥ弬鑰?/p> <p><a target="_blank">codeproject Hooks and DLLs</a> 鎴戠殑hook dll閮芥槸鐓х潃瀹冨啓鐨勩?/p><img src ="http://www.shnenglu.com/gohan/aggbug/50122.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gohan/" target="_blank">Gohan</a> 2008-05-17 02:05 <a href="http://www.shnenglu.com/gohan/archive/2008/05/17/50122.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鑾峰彇緇欏畾璺緞鐨勫浘鏍囷紝婕旂ずSHGetFileInfo鐢ㄦ硶http://www.shnenglu.com/gohan/archive/2008/05/02/48617.htmlGohanGohanThu, 01 May 2008 20:54:00 GMThttp://www.shnenglu.com/gohan/archive/2008/05/02/48617.htmlhttp://www.shnenglu.com/gohan/comments/48617.htmlhttp://www.shnenglu.com/gohan/archive/2008/05/02/48617.html#Feedback0http://www.shnenglu.com/gohan/comments/commentRss/48617.htmlhttp://www.shnenglu.com/gohan/services/trackbacks/48617.html鍩轟簬涓婃閭d釜SHBrowseForFolder鐢ㄦ硶鐨勬紨紺轟唬鐮?/font>
寤虹珛鐨勪粛鐒舵槸Win32 鍛戒護琛岀殑宸ョ▼錛屾墍浠ュ叆鍙g偣涓簃ain(),闇瑕佹墜鍔ㄨ幏鍙朒INSTANCE緇撴瀯銆傜▼搴忓湪WINXP+VS2005嫻嬭瘯閫氳繃image
/********************************************************************
  created:  2008/05/02
  created:  2:5:2008   3:40
            main.cpp
  author:    Gohan
  purpose:  婕旂ずSHBrowseForFolder鐢ㄦ硶
            婕旂ずSHGetFileInfo鑾峰彇璺緞鍥炬爣   
            婕旂ずPicture Box鍦⊿DK閲岀殑浣跨敤鏂規硶
*********************************************************************/
#include <Windows.h>
#include <ShlObj.h>
#include "resource.h"
HICON g_icon;
RECT g_rect;
TCHAR g_path[MAX_PATH];
void OnInitDlg(HWND hwnd)
{
   
GetWindowRect(GetDlgItem(hwnd, IDC_ICON1), &g_rect);
   
MapWindowPoints(NULL, hwnd, (LPPOINT) &g_rect, 2);
   
DestroyWindow(GetDlgItem(hwnd, IDC_ICON1));
   
SetDlgItemText(hwnd,IDC_PATH,g_path);
}
void OnPaint(HWND hwnd)
{
   
PAINTSTRUCT ps;
   
HDC hdc = BeginPaint(hwnd, &ps);
   
DrawIcon(hdc,g_rect.left,g_rect.left,g_icon);
   
EndPaint(hwnd,&ps);
}
BOOL CALLBACK DlgProc (HWND hDlg, UINT message,
                           
WPARAM wParam, LPARAM lParam)
{
   
switch (message)
    {
   
case WM_INITDIALOG :
       
OnInitDlg(hDlg);
       
return TRUE ;
   
case WM_PAINT:
       
OnPaint(hDlg);
       
return TRUE;
   
case WM_COMMAND :
       
switch (LOWORD (wParam))
        {
       
case IDOK :
       
case IDCANCEL :
           
EndDialog (hDlg, 0) ;
           
return TRUE ;
        }
       
break ;
    }
   
return FALSE ;
}
int main()
{
   
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
   
BROWSEINFO bi;
   
ZeroMemory(&bi,sizeof(BROWSEINFO));
   
LPMALLOC pMalloc;
   
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
   
   
if(pidl != NULL)
    {
       
SHGetPathFromIDList(pidl,g_path);
       
SHFILEINFO sfi;
       
ZeroMemory(&sfi,sizeof(SHFILEINFO));
       
SHGetFileInfo(g_path,0,&sfi,sizeof(SHFILEINFO),SHGFI_ICON);
       
g_icon = sfi.hIcon;
       
DialogBox (hInstance, MAKEINTRESOURCE(IDD_DIALOG1), 0, DlgProc) ;
       
//MessageBox(NULL,path,TEXT("Choose"),MB_OK);
        if(SUCCEEDED(SHGetMalloc(&pMalloc)))
        {
           
pMalloc->Free(pidl);
           
pMalloc->Release();
        }
    }
   
else
    {
       
MessageBox(NULL,TEXT("),TEXT("Choose"),MB_OK);
    }
}
/************************************************************************/
/* resource.h                                                           */
/************************************************************************/
#define IDD_DIALOG1                     101
#define IDC_PATH                        1001
#define IDC_ICON1                       1002
/************************************************************************/
/* demo.rc Microsoft Visual C++ generated resource script.              */
/************************************************************************/
#include "resource.h"
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
//
// Dialog
//

IDD_DIALOG1 DIALOGEX 0, 0, 126, 83
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP
FONT
8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
    DEFPUSHBUTTON   "紜畾",IDOK,69,7,50,14
   
PUSHBUTTON      "鍙栨秷",IDCANCEL,69,24,50,14
   
CONTROL         "",IDC_ICON1,"Static",SS_WHITEFRAME | SS_REALSIZEIMAGE,13,10,20,20,WS_EX_TRANSPARENT
    LTEXT           "闈欐?,IDC_PATH,14,44,89,21,0,WS_EX_CLIENTEDGE
END


/////////////////////////////////////////////////////////////////////////////


Gohan 2008-05-02 04:54 鍙戣〃璇勮
]]>
嫻忚鏂囦歡澶瑰璇濇錛屾紨紺篠HBrowseForFolder鐢ㄦ硶http://www.shnenglu.com/gohan/archive/2008/04/24/47993.htmlGohanGohanThu, 24 Apr 2008 05:15:00 GMThttp://www.shnenglu.com/gohan/archive/2008/04/24/47993.htmlhttp://www.shnenglu.com/gohan/comments/47993.htmlhttp://www.shnenglu.com/gohan/archive/2008/04/24/47993.html#Feedback10http://www.shnenglu.com/gohan/comments/commentRss/47993.htmlhttp://www.shnenglu.com/gohan/services/trackbacks/47993.htmlimage
/********************************************************************
  created:  2008/04/24
  created:  24:4:2008   12:47
  author:    Gohan
                http://feed.feedsky.com/gohan
  purpose:  婕旂ずSHBrowseForFolder鐢ㄦ硶
*********************************************************************/
#include <Windows.h>
#include <ShlObj.h>
int main()
{
   
BROWSEINFO bi;
   
ZeroMemory(&bi,sizeof(BROWSEINFO));
   
LPMALLOC pMalloc;
   
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);
   
TCHAR * path = new TCHAR[MAX_PATH];
   
if(pidl != NULL)
    {
       
SHGetPathFromIDList(pidl,path);
       
MessageBox(NULL,path,TEXT("Choose"),MB_OK);
       
if(SUCCEEDED(SHGetMalloc(&pMalloc)))//pidl鎸囧悜鐨勫璞$敤瀹屽簲璇ラ噴鏀撅紝涔嬪墠蹇界暐浜?br>        {
           
pMalloc->Free(pidl);
           
pMalloc->Release();
        }
    }
   
else
    {
       
MessageBox(NULL,TEXT("閫夋嫨涓虹┖"),TEXT("Choose"),MB_OK);
    }
   
delete path;//璋㈣阿true鐨勬彁閱掞紝浠ュ悗鎴戜竴瀹氫細鏇村姞鎱庨噸
}



Gohan 2008-04-24 13:15 鍙戣〃璇勮
]]>
LPC 鐨勪竴涓ず渚嬶紙Ntdll Port API test錛?/title><link>http://www.shnenglu.com/gohan/archive/2008/02/28/43367.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Wed, 27 Feb 2008 16:48:00 GMT</pubDate><guid>http://www.shnenglu.com/gohan/archive/2008/02/28/43367.html</guid><wfw:comment>http://www.shnenglu.com/gohan/comments/43367.html</wfw:comment><comments>http://www.shnenglu.com/gohan/archive/2008/02/28/43367.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gohan/comments/commentRss/43367.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gohan/services/trackbacks/43367.html</trackback:ping><description><![CDATA[     鎽樿: 涔嬪墠灝忓皬瀛︿簡涓鐐箇in32 LPC鐨勭煡璇嗭紝榪欎釜sample鏄痺ine ref鐨勪竴涓猼est錛屾劅瑙夊凡緇忓緢鍏ㄩ潰銆備粖澶╄繕鎵炬潵浜嗕袱鏈叧浜嶯tdll鏂歸潰鐨勭數瀛愪功錛學indows_2000_Native_API_Reference錛孶ndocumented Windows 2000 Secrets..閮芥槸鑻辨枃涔︼紝鎱㈡參鍟冦? 1 /* Unit test suite for Ntdll Port API fun...  <a href='http://www.shnenglu.com/gohan/archive/2008/02/28/43367.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/gohan/aggbug/43367.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gohan/" target="_blank">Gohan</a> 2008-02-28 00:48 <a href="http://www.shnenglu.com/gohan/archive/2008/02/28/43367.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>鍏充簬Up/Down鎺т歡錛坰pin control錛変嬌鐢ㄦ柟娉曠殑涓鐐瑰皬蹇冨緱http://www.shnenglu.com/gohan/archive/2008/02/06/42558.htmlGohanGohanTue, 05 Feb 2008 18:14:00 GMThttp://www.shnenglu.com/gohan/archive/2008/02/06/42558.htmlhttp://www.shnenglu.com/gohan/comments/42558.htmlhttp://www.shnenglu.com/gohan/archive/2008/02/06/42558.html#Feedback0http://www.shnenglu.com/gohan/comments/commentRss/42558.htmlhttp://www.shnenglu.com/gohan/services/trackbacks/42558.html image    瀛︾敤綰疭DK鍐檞in32紼嬪簭錛岃祫鏂欐湁涓涓?a target="_blank">鑻辨枃鐗圵indows Programming鐢靛瓙涔︼紝浠ュ強MSDN錛岀敤鍒頒簡Up/Down鎺т歡璁╃敤鎴瘋緭鍏ユ暟鎹紝鍚屾椂涔熸彁渚涗簡Edit box.涓よ呯殑鍚屾鏄惁浼氭湁闂鍛紵
  灝濊瘯浜嗗崐澶╋紝緇堜簬鏈変簡鐐圭粨鏋滐細
1銆佸垵濮嬪寲鎺т歡錛屽鎺т歡鍙ユ焺鍙戦?a target="_blank">UDM_SETRANGE32娑堟伅錛岃繘琛岃寖鍥寸殑鍒濆璇濄?a target="_blank">UDM_SETPOS32娑堟伅璁劇疆鍒濆箋?br>    image
2銆佸叧鑱擡dit Box 鎺т歡錛岃繖涓垜寮勪簡鍗婂ぉ鎵嶆槑鐧斤紝棣栧厛瑕佸湪璧勬簮緙栬緫涓殑瀵硅瘽妗嗙紪杈戠晫闈紝璁懼畾Tab鎺т歡鐨勯『搴忥紙鏍煎紡->Tab閿『搴忥級銆?font color="#ff0000">灝咵dit Box鐨勫簭鍙瘋緗垚Up/Down鎺т歡搴忓彿鍑忎竴錛岃瀹歎p/Down鐨勫睘鎬uto Buddy涓篢rue錛孲et Buddy Integer涓簍rue銆?br>3銆佺幇鍦ㄥ凡緇忚兘澶熸甯哥殑浣跨敤Up/Down鍔熻兘浜嗐?br>  鍙槸濡傛灉涓嶆兂鐢ㄦ帶浠跺叧鑱?/font>錛岃屾槸鑷繁璁懼畾閫昏緫鎬庝箞鍔炲憿錛熷嚑涓皬鏃朵箣鍓嶆垜涓嶄細鍏寵仈鐨勬柟娉曪紝鎯寵鍔姏瀹炵幇鎵嬪姩緇存姢Edit box鐨勫姛鑳姐傛渶鍚庣粓浜庢湁浜嗕簺鏁欒錛屽緱鍒頒簡鐐瑰績寰楋細
  鍦║p/Down鐨勭埗紿楀彛錛堜竴鑸槸瀵硅瘽妗嗭級鐨勬秷鎭鐞嗗嚱鏁頒腑錛屽WM_VSCROLL娑堟伅鍋氫竴涓鐞嗭紝褰搇Param涓嶶p/Down鐨勭獥鍙e彞鏌勭浉絳夋椂錛屽Up/Down鐨勬搷浣滅粨鏉?/font> 錛屽叾涓瓀Param涓殑楂樹綅閮ㄥ垎鏄疷p/Down鐨勫鹼紝鐢ㄨ繖涓兼潵鏇存柊Edit Box銆?br>WM_VSCROLL nScrollCode = (int)LOWORD(wParam);
  nPos = (short int)HIWORD(wParam);
  hwndScrollBar = (HWND) lParam;

  浠婂ぉ鎴戠殑鏁欒鏄嬌鐢ㄤ簡WM_NOTIFY鐨勬秷鎭紝澶勭悊UDN_DELTAPOS鐨勯氱煡錛宭Param鏄竴涓粨鏋勶細NMUPDOWN錛岄氳繃榪欎釜緇撴瀯鏉ユ洿鏂癊dit box錛屽洜涓鴻繖涓氱煡涓嶇瓑鎿嶄綔緇撴潫灝卞凡緇忓彂鍑猴紝騫朵笖榪欎釜緇撴瀯浣撲腑鏈夊綋鏃剁殑浣嶇疆浠ュ強鍙樺寲閲忥紝鏇存柊鏃跺欒繕闇瑕佸皢褰撴椂浣嶇疆鍔犱笂鍙樺寲閲忋傝繖鏍風殑鏇存柊灝變細鍑虹幇涓瀹氱殑闂錛屾湁鏃跺檖os宸茬粡鍒頒簡璁懼畾濂界殑鑼冨洿杈圭晫錛宲os鍔犱笂鍙樺寲閲忓氨浼氳秴鍑鴻竟鐣岋紝榪樿緇х畫鍒ゆ柇錛屾晥鐜囩瓑絳夐棶棰樺氨鍑虹幇浜嗭紝鑰屼笖鍗佸垎楹葷儲銆傛墍浠ユ渶濂戒嬌鐢ㄥ叧鑱旂殑鏂規硶錛屽鏋滄湁鐗規畩瑕佹眰灝辯敤WM_VSCROLL鍝嶅簲錛?font color="#ff0000">鍗冧竾涓嶈浣跨敤UDN_DELTAPOS錛岀櫧鑺卞姛澶?/font>錛屽懙鍛點傚氨鍐欏埌榪欓噷.

浠婂ぉ鏄櫎澶曚簡錛岀鎵鏈夌▼搴忓憳鏈嬪弸鏂版槬蹇箰錛侊紒



Gohan 2008-02-06 02:14 鍙戣〃璇勮
]]>
緲昏瘧涔犱綔:Create your own controls - the art of subclassing 瀛愮被鍖?緇ф壙鍏叡鎺т歡http://www.shnenglu.com/gohan/archive/2008/01/25/41852.htmlGohanGohanThu, 24 Jan 2008 16:02:00 GMThttp://www.shnenglu.com/gohan/archive/2008/01/25/41852.htmlhttp://www.shnenglu.com/gohan/comments/41852.htmlhttp://www.shnenglu.com/gohan/archive/2008/01/25/41852.html#Feedback0http://www.shnenglu.com/gohan/comments/commentRss/41852.htmlhttp://www.shnenglu.com/gohan/services/trackbacks/41852.html闃呰鍏ㄦ枃

Gohan 2008-01-25 00:02 鍙戣〃璇勮
]]>
VC++緙栫▼鍐呭箷瀛︿範蹇冨緱(2)--涓?/title><link>http://www.shnenglu.com/gohan/archive/2007/12/08/38045.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Sat, 08 Dec 2007 10:04:00 GMT</pubDate><guid>http://www.shnenglu.com/gohan/archive/2007/12/08/38045.html</guid><wfw:comment>http://www.shnenglu.com/gohan/comments/38045.html</wfw:comment><comments>http://www.shnenglu.com/gohan/archive/2007/12/08/38045.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/gohan/comments/commentRss/38045.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gohan/services/trackbacks/38045.html</trackback:ping><description><![CDATA[     鎽樿: 鎺ョ潃涓婂洖寮濮?涔︿笂鐨勭浜屼釜渚嬪瓙 鐩存帴璐存垜鐣ュ姞淇敼鐨勪唬鐮?鍚庨潰闄勬湁娉ㄩ噴: void Cfont2View::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) {//鎯寵鐨勬槸OnPrepareDC鍦ㄦ瘡嬈¤皟鐢∣nDraw涔嬪墠璋冪敤,鍙湪閲岄潰榪涜鍒濆鍖栫殑涓浜涙搷浣?    CRect clientRect;     ...  <a href='http://www.shnenglu.com/gohan/archive/2007/12/08/38045.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/gohan/aggbug/38045.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gohan/" target="_blank">Gohan</a> 2007-12-08 18:04 <a href="http://www.shnenglu.com/gohan/archive/2007/12/08/38045.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>VC++緙栫▼鍐呭箷瀛︿範蹇冨緱(2)--涓?/title><link>http://www.shnenglu.com/gohan/archive/2007/11/26/37345.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Mon, 26 Nov 2007 13:46:00 GMT</pubDate><guid>http://www.shnenglu.com/gohan/archive/2007/11/26/37345.html</guid><wfw:comment>http://www.shnenglu.com/gohan/comments/37345.html</wfw:comment><comments>http://www.shnenglu.com/gohan/archive/2007/11/26/37345.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.shnenglu.com/gohan/comments/commentRss/37345.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gohan/services/trackbacks/37345.html</trackback:ping><description><![CDATA[     鎽樿: 絎叚绔?GDI,瀛椾綋,浣嶅浘 絎簲绔犵殑渚嬪瓙灝辨湁綆鍗曠殑CDC綾誨瀷鐨勫簲鐢?榪欐鏇村姞璇︾粏鐨勬葷粨浜嗚澶囩幆澧冪被鍨嬪強鍏跺簲鐢ㄥ父鐢ㄧ被鍨婥ClientDC鍜孋WindowDC,綆楀仛鏄劇ず璁懼鍑芥暟 CDC::GetClipBox(LPRECT lpRect)鑳藉鑾峰彇褰撳墠鎿嶄綔dc鍙鐨勫尯鍩熺煩褰㈠惂,鎴戝ぇ姒傝繖鏍峰瓙鐞嗚В.褰撶劧,鏄犲皠妯″紡涓嶅悓鐨勬儏鍐靛緱鍒扮殑鍊間篃涓嶄竴鏍?鏄昏緫鍧愭爣鍗曚綅 鍙湁鏀瑰啓瑙嗗浘綾葷殑OnPaint綾繪椂鎵嶄細鐢–Paint...  <a href='http://www.shnenglu.com/gohan/archive/2007/11/26/37345.html'>闃呰鍏ㄦ枃</a><img src ="http://www.shnenglu.com/gohan/aggbug/37345.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gohan/" target="_blank">Gohan</a> 2007-11-26 21:46 <a href="http://www.shnenglu.com/gohan/archive/2007/11/26/37345.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>vc++鎶鏈唴騫曞涔犲績寰?http://www.shnenglu.com/gohan/archive/2007/11/23/37213.htmlGohanGohanFri, 23 Nov 2007 08:37:00 GMThttp://www.shnenglu.com/gohan/archive/2007/11/23/37213.htmlhttp://www.shnenglu.com/gohan/comments/37213.htmlhttp://www.shnenglu.com/gohan/archive/2007/11/23/37213.html#Feedback0http://www.shnenglu.com/gohan/comments/commentRss/37213.htmlhttp://www.shnenglu.com/gohan/services/trackbacks/37213.html榪欑瘒蹇冨緱鍏充簬鎶鏈唴騫曠浜旂珷,姣旇緝鐨勫熀紜..
鎴戞槸VC++鐨勫垵瀛﹁?br>vc++
鎶鏈唴騫曡繖鏈功鎴戞槸鍘誨勾鏆戝亣寮濮嬬湅鐨?span lang=EN-US>,閭f椂鍊欏垰瀛?span lang=EN-US>windows緙栫▼,铏界劧涔嬪墠鐢ㄨ繃c#,vb,涓嶈繃閮芥病鎬庝箞緇冧範,榪欐湰涔︽垜澶ф鐪嬩簡鍓嶉潰鐨?span lang=EN-US>80%,涓嶈繃閮芥湭鏇懼姩鎵?span lang=EN-US>,榪戞棩鎵撶畻浠庡ご緇冧範涓涓?span lang=EN-US>,鍦ㄨ繖閲岃浜涚瑪璁?span lang=EN-US>
絎簲绔犵涓涓緥瀛愬緢綆鍗?/strong>
涓涓崟鏂囨。MFC搴旂敤紼嬪簭,View綾諱腑涓涓?span lang=EN-US>CRect綾誨瀷鍙橀噺淇濆瓨鐭╁艦鐨勪俊鎭?span lang=EN-US>,涓涓?span lang=EN-US>int鍨嬩繚瀛樼煩褰㈤鑹茬殑灞炴?span lang=EN-US>
WM_LBUTTONDOWN鍝嶅簲鍑芥暟鍒ゆ柇鍗曞嚮宸﹂敭鏃墮紶鏍囦綅緗槸涓嶆槸鍦ㄤ箣鍓嶉偅涓煩褰㈠尯鍩熷唴,鏄殑璇濆彉鎹㈢煩褰㈤鑹茬殑灞炴?span lang=EN-US>,鑰屼笖鍛戒護鐭╁艦鍖哄煙閲嶇粯..
OnDraw()
涓敤dc閫夊彇鐭╁艦棰滆壊,緇樺埗鐭╁艦鐨勫唴鍒囨き鍦?span lang=EN-US>

搴旂敤鐨勫嚱鏁版湁:

virtual CGdiObject* CDC::SelectStockObject(

int nIndex

);//閫夊彇棰滆壊,榪欓噷鍙夌敾鍒峰ぇ姒傛湁濡備笅鐢誨埛
BLACK_BRUSH DKGRAY_BRUSH GRAY_BRUSH HOLLOW_BRUSH LTGRAY_BRUSH NULL_BRUSH WHITE_BRUSH
BOOL CDC::Ellipse(LPCRECT lpRect);//
鐢葷煩褰㈠搴旂殑鍐呭垏妞渾
BOOL CRECT::PtInRect(

POINT point 

) const throw( );//鍒ゆ柇point鏄惁鍦ㄧ煩褰腑

娉ㄦ剰涓鐐瑰氨鏄?/span>CView::OnLButtonDown(UINT nFlags, CPoint point)
榪欓噷鐨?/span>Point鍧愭爣鏄?/span>View鐨?/span>client鍧愭爣,濡傛灉闇瑕佸叏灞鍧愭爣闇瑕佽漿鎹?/span>

 

絎簩涓緥瀛愬叧浜庢槧灝勬ā寮?/span>

 

涓嶅悓鐨勬槧灝勬ā寮?/span>,瀵瑰簲鐨勫潗鏍囨槸鏈夊尯鍒殑,鑰屼笖浠栦滑鐨勯昏緫鍗曚綅姣斾緥閮戒笉鍚?/span>

 

鍥哄畾姣斾緥鐨勬槧灝勬ā寮忔湁

 

Mapping Mode

Logical Unit

MM_LOENGLISH

0.01 inch

MM_HIENGLISH

0.001 inch

MM_LOMETRIC

0.1 mm

MM_HIMETRIC

0.01 mm

MM_TWIPS

1/1440 inch

 

鍙彉姣斾緥鐨勬槧灝勬ā寮?/span>

MM_ISOTROPIC and MM_ANISOTROPIC

鎴戣嚜宸卞啓浜嗕竴涓?/span>Demo鐪嬩簡涓涓?/span>,濂藉儚鍙湁MM_ANISOTROPIC璺?/span>MM_TEXT鏄?/span>x杞村乏鍚戝彸,y杞翠笂鍒頒笅,DC鍘熺偣涓?/span>0,0

鍏朵粬鐨勬槧灝勬ā寮?/span>x杞翠竴鏍?/span>,y杞村彉鎴愪簡浠庝笅鑷充笂,DC鍘熺偣榪樻槸0,0

CDC鐨勫嚑涓嚱鏁拌繖閲屾湁蹇呰璇磋
virtual int CDC::SetMapMode(
   int nMapMode
);
int CDC::GetMapMode() const;
璁劇疆/璇誨彇DC鐨勬槧灝勬ā寮?/span>

 

virtual CSize CDC::SetWindowExt(
   int cx,
   int cy
);//
璁劇疆紿椾綋鑼冨洿

virtual CSize CDC::SetViewportExt(
   int cx,
   int cy
);//
璁劇疆瑙嗗彛鑼冨洿

virtual CPoint CDC::SetViewportOrg(
   int x,
   int y
);//
璁劇疆(0,0)鐐圭殑浣嶇疆

紿椾綋鑼冨洿鍜岃鍙h寖鍥寸殑璁劇疆浼氬獎鍝嶅彲鍙樻瘮渚嬫槧灝?/span>
鍙彉姣斾緥鏄犲皠鐨?/span>x,y璁$畻鏂規硶鍙傜湅涓嬮潰鐨勫叕寮?/span>

x scale factor = x viewport extent / x window extent   

y scale factor = y viewport extent / y window extent   

device x = logical x* x scale factor + x origin offset   

device y = logical y* y scale factor + y origin offset

CDC鎴愬憳鍑芥暟鐨勫弬鏁板ぇ閮芥槸鐢ㄩ昏緫鍧愭爣,浣嗘槸CWnd鐨勬垚鍛樺嵈浠ヨ澶囧潗鏍囦負鍙傛暟

浣嗘槸CDC鎴愬憳涓湁鍑芥暟

LPtoDP,灝嗛昏緫鍧愭爣杞崲涓鴻澶囧潗鏍?/span>

void LPtoDP( LPPOINT lpPoints, int nCount = 1 ) const; void LPtoDP( LPRECT lpRect ) const; void LPtoDP( LPSIZE lpSize ) const;
DPtoLP,鍒氬ソ鐩稿弽

void DPtoLP( LPPOINT lpPoints, int nCount = 1 ) const; void DPtoLP( LPRECT lpRect ) const; void DPtoLP( LPSIZE lpSize ) const;

絎笁涓緥瀛愬叧浜庢粴鍔ㄦ潯

鏂囨。瑙嗗浘鐨勫伐紼嬪緩绔嬪悜瀵間腑鍙互璁?/span>View緇ф壙鑷?/span>CScrollView,浣垮緱View甯︽湁婊氬姩鏉?/span>

OnInitialUpdate鍑芥暟鍦ㄨ鍥懼緩绔嬪悗,OnDraw鎵ц涔嬪墠鎵ц,鎵浠ュ浜庢粴鍔ㄦ潯鐨勫垵濮嬪寲鍙互鏀懼湪榪欎釜鍑芥暟涓?/span>

void CScrollingViewWindowView::OnInitialUpdate()

{

    CScrollView::OnInitialUpdate();

    CSize sizeTotal;

    // TODO: 璁$畻姝よ鍥劇殑鍚堣澶у皬

    sizeTotal.cx = 20000; //20cm

    sizeTotal.cy = 30000; //30cm

    CSize sizePage(sizeTotal.cx/2,sizeTotal.cy/2);

    CSize sizeLine(sizeTotal.cx/50,sizeTotal.cy/50);

    SetScrollSizes(MM_TEXT, sizeTotal,sizePage,sizeLine);

}

铏界劧鏄垵濮嬪寲浜嗘粴鍔ㄦ潯,浣嗘槸涓嶈兘澶熶嬌鐢ㄥ揩鎹烽敭(涓婁笅宸﹀彸,pagedown鍟ョ殑),闇瑕佹墜鍔ㄩ噸杞?/span>afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);

闇瑕佺敤鍒?/span>CWnd::OnVScroll, CWnd::OnHScroll,鍒嗗埆鎺у埗綰靛悜涓庢í鍚戜袱涓粴鍔ㄦ潯

nSBCode

Specifies a scroll-bar code that indicates the user's scrolling request. This parameter can be one of the following:

·         SB_BOTTOM   Scroll to bottom.

·         SB_ENDSCROLL   End scroll.

·         SB_LINEDOWN   Scroll one line down.

·         SB_LINEUP   Scroll one line up.

·         SB_PAGEDOWN   Scroll one page down.

·         SB_PAGEUP   Scroll one page up.

·         SB_THUMBPOSITION   Scroll to the absolute position. The current position is provided in nPos.

·         SB_THUMBTRACK   Drag scroll box to specified position. The current position is provided in nPos.

·         SB_TOP   Scroll to top.

                                                       by gohan 11.23



Gohan 2007-11-23 16:37 鍙戣〃璇勮
]]>
SubclassWindow 涓涓嚱鏁?鍏跺疄鏄釜瀹?/title><link>http://www.shnenglu.com/gohan/archive/2007/06/03/25361.html</link><dc:creator>Gohan</dc:creator><author>Gohan</author><pubDate>Sat, 02 Jun 2007 16:26:00 GMT</pubDate><guid>http://www.shnenglu.com/gohan/archive/2007/06/03/25361.html</guid><wfw:comment>http://www.shnenglu.com/gohan/comments/25361.html</wfw:comment><comments>http://www.shnenglu.com/gohan/archive/2007/06/03/25361.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.shnenglu.com/gohan/comments/commentRss/25361.html</wfw:commentRss><trackback:ping>http://www.shnenglu.com/gohan/services/trackbacks/25361.html</trackback:ping><description><![CDATA[#define     SubclassWindow(hwnd, lpfn)       \<br>              ((WNDPROC)SetWindowLongPtr((hwnd), GWLP_WNDPROC, (LPARAM)(WNDPROC)(lpfn)))<br><br>榪欎釜瀹忔槸鎴戠湅絎竷绔爓inshellprograming鐪嬪埌鐨?寰堝己澶х殑鍔熻兘,渚嬪瓙鏄敤FindWindowEx鎵懼埌windows寮濮嬫寜閽殑紿楀彛鍙ユ焺,涔嬪悗鐢ㄨ瀹忓姞鍏ュ紑濮嬫寜閽殑娑堟伅澶勭悊鍑芥暟.鎬諱箣榪樹笉閿?winshell榪樼湡涓嶆槸涓鑸?.<br>MSDN涓婃煡SubclassWindow閮戒笉鏄垜瑕佺殑榪欎釜,铏界劧鍔熻兘澶т綋鐩稿悓鍚?<br>涓嬮潰榪欎釜灝辨槸SetWindowLongPtr鍑芥暟:<br> <div id="44q688o" class="title">SetWindowLongPtr Function</div> <!--content type: SDKML. Transform: psdk2mtps.xslt.--> <div id="gow44ys" class="clsDocBody"> <p> </p> <p>The <strong>SetWindowLongPtr</strong> function changes an attribute of the specified window. The function also sets a value at the specified offset in the extra window memory.<br><br>榪欎釜鍑芥暟鏀瑰彉涓涓寚瀹氱獥鍙g殑涓涓睘鎬?瀹冧篃鍙瀹氱獥鍙e偍瀛樺尯鎸囧畾鍋忕Щ浣嶇疆鐨勫箋?br></p> <p>This function supersedes the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl01',this);" ><u><font color="#0000ff">SetWindowLong</font></u></a> function. To write code that is compatible with both 32-bit and 64-bit versions of Microsoft Windows, use <strong>SetWindowLongPtr</strong>.<br>榪欎釜鍑芥暟鍙栦唬浜哠etWindowLong鍑芥暟,涓轟簡鍏煎32浣?4浣峸indows os,灝辯敤榪欎釜鍑芥暟鍚?.<br></p> <p class="clsRef">Syntax</p> <blockquote> <div id="4ucwaau" class="code" id="ctl00_LibFrame_ctl02_">LONG_PTR SetWindowLongPtr(      <br>    HWND <em>hWnd</em>,<br>    int <em>nIndex</em>,<br>    LONG_PTR <em>dwNewLong</em><br>);</div> </blockquote> <p class="clsRef">Parameters</p> <blockquote> <dl> <dt><em>hWnd</em> </dt><dd>[in] Handle to the window and, indirectly, the class to which the window belongs. The <strong>SetWindowLongPtr</strong> function fails if the process that owns the window specified by the <em>hWnd</em> parameter is at a higher process privilege in the User Interface Privilege Isolation (UIPI) hierarchy than the process the calling thread resides in. </dd><dd>榪斿洖fail褰撴嫢鏈夋寚瀹氱獥鍙g殑浜煄姣旂敤鎴稶I鏉冮檺闅旂粷(??)楂樼殑鏃跺?.涓嶇煡閬撶炕璇戝涓? </dd><dd> <p><strong>Microsoft Windows XP and earlier:</strong> The <strong>SetWindowLongPtr</strong> function fails if the window specified by the <em>hWnd</em> parameter does not belong to the same process as the calling thread.<br><br>榪欎釜鎰忔濆ぇ姒傛槸鍑芥暟澶辮觸濡傛灉璋冪敤榪涚▼浼犲叆鐨刪Wnd鍙ユ焺涓嶅睘浜庤皟鐢ㄥ寘鍚繖涓嚱鏁扮殑綰跨▼鐨勮繘紼嬶紙搴旂敤紼嬪簭錛?</p> </dd><dt><em>nIndex</em> </dt><dd>[in] Specifies the zero-based offset to the value to be set. Valid values are in the range zero through the number of bytes of extra window memory, minus the size of an integer. To set any other value, specify one of the following values. </dd><dd>榪欎釜涓嶇敤緲昏瘧浜?寰堟槑浜嗗搱鍝? </dd><dd> <dl> <dt><span id="yeceoek" class="clsRange"><!----></span> </dt><dd> <dl> <dt><code>GWL_EXSTYLE</code> </dt><dd>Sets a new extended window style. For more information, see <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl03',this);" ><u><font color="#0000ff">CreateWindowEx</font></u></a>. </dd><dt><code>GWL_STYLE</code> </dt><dd>Sets a new <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl04',this);" ><u><font color="#0000ff">window style</font></u></a>. </dd><dt><code>GWLP_WNDPROC</code> </dt><dd>Sets a new address for the window procedure. </dd><dt><code>GWLP_HINSTANCE</code> </dt><dd>Sets a new application instance handle. </dd><dt><code>GWLP_ID</code> </dt><dd>Sets a new identifier of the window. </dd><dt><code>GWLP_USERDATA</code> </dt><dd>Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.</dd></dl> </dd><dt><span id="8aeguk4" class="clsRange"><!----></span> </dt><dd>The following values are also available when the <em>hWnd</em> parameter identifies a dialog box. <dl> <dt><code>DWLP_DLGPROC</code> </dt><dd>Sets the new pointer to the dialog box procedure. </dd><dt><code>DWLP_MSGRESULT</code> </dt><dd>Sets the return value of a message processed in the dialog box procedure. </dd><dt><code>DWLP_USER</code> </dt><dd>Sets new extra information that is private to the application, such as handles or pointers.</dd></dl></dd></dl> </dd><dt><em>dwNewLong</em> </dt><dd>[in] Specifies the replacement value. </dd></dl></blockquote> <p class="clsRef">Return Value</p> <blockquote> <p>If the function succeeds, the return value is the previous value of the specified offset.<br>鎴愬姛榪斿洖鐨勬槸璁劇疆鍓嶇殑鍊糒ONG_PTR榪欎釜綾誨瀷<br></p> <p>If the function fails, the return value is zero. To get extended error information, call <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl05',this);" ><u><font color="#0000ff">GetLastError</font></u></a>. </p> <p>If the previous value is zero and the function succeeds, the return value is zero, but the function does not clear the last error information. To determine success or failure, clear the last error information by calling <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl06',this);" ><u><font color="#0000ff">SetLastError</font></u></a>(0), then call <strong>SetWindowLongPtr</strong>. Function failure will be indicated by a return value of zero and a <strong>GetLastError</strong> result that is nonzero.</p> <br></blockquote> <p class="clsRef">Remarks</p> <blockquote> <p>Certain window data is cached, so changes you make using <strong>SetWindowLongPtr</strong> will not take effect until you call the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl07',this);" ><u><font color="#0000ff">SetWindowPos</font></u></a> function.</p> <p>If you use <strong>SetWindowLongPtr</strong> with the GWLP_WNDPROC index to replace the window procedure, the window procedure must conform to the guidelines specified in the description of the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl08',this);" ><u><font color="#0000ff">WindowProc</font></u></a> callback function. </p> <p>If you use <strong>SetWindowLongPtr</strong> with the DWLP_MSGRESULT index to set the return value for a message processed by a dialog box procedure, the dialog box procedure should return TRUE directly afterward. Otherwise, if you call any function that results in your dialog box procedure receiving a window message, the nested window message could overwrite the return value you set by using DWLP_MSGRESULT. </p> <p>Calling <strong>SetWindowLongPtr</strong> with the GWLP_WNDPROC index creates a subclass of the window class used to create the window. An application can subclass a system class, but should not subclass a window class created by another process. The <strong>SetWindowLongPtr</strong> function creates the window subclass by changing the window procedure associated with a particular window class, causing the system to call the new window procedure instead of the previous one. An application must pass any messages not processed by the new window procedure to the previous window procedure by calling <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl09',this);" ><u><font color="#0000ff">CallWindowProc</font></u></a>. This allows the application to create a chain of window procedures. </p> <p>Reserve extra window memory by specifying a nonzero value in the <strong>cbWndExtra</strong> member of the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl10',this);" ><u><font color="#0000ff">WNDCLASSEX</font></u></a> structure used with the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl11',this);" ><u><font color="#0000ff">RegisterClassEx</font></u></a> function. </p> <p>Do not call <strong>SetWindowLongPtr</strong> with the GWLP_HWNDPARENT index to change the parent of a child window. Instead, use the <a onclick="javascript:Track('ctl00_LibFrame_ctl00|ctl00_LibFrame_ctl12',this);" ><u><font color="#0000ff">SetParent</font></u></a> function. </p> <p>If the window has a class style of CS_CLASSDC or CS_PARENTDC, do not set the extended window styles WS_EX_COMPOSITED or WS_EX_LAYERED.</p> <p><strong>Windows XP/Vista:</strong> Calling <strong>SetWindowLongPtr</strong> to set the style on a progressbar will reset its position.</p> </blockquote> <p class="clsRef">Function Information</p> </div> <br><br>鍏堝埌榪欓噷,浠ュ悗浼氬啓鏇村Win32鐨勫熀紜鐭ヨ瘑,褰撴垜瀛﹀埌鐨勬椂鍊?.<br><br>btw,鏈夋湰鍙玹he old new thing 浼間箮寰堝己,涓嶇煡閬撲粈涔堟椂鍊欒兘鏈変竴鏈?.. <img src ="http://www.shnenglu.com/gohan/aggbug/25361.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.shnenglu.com/gohan/" target="_blank">Gohan</a> 2007-06-03 00:26 <a href="http://www.shnenglu.com/gohan/archive/2007/06/03/25361.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item></channel></rss> <footer> <div class="friendship-link"> <p>感谢您访问我们的网站,您可能还对以下资源感兴趣:</p> <a href="http://www.shnenglu.com/" title="精品视频久久久久">精品视频久久久久</a> <div class="friend-links"> </div> </div> </footer> <a href="http://www.pf925.cn" target="_blank">国产精品久久久久久久久软件</a>| <a href="http://www.950aw.cn" target="_blank">国产精品一区二区久久</a>| <a href="http://www.santoncc.cn" target="_blank">久久精品人人做人人妻人人玩</a>| <a href="http://www.gb9948-2013.cn" target="_blank">久久黄视频</a>| <a href="http://www.r234.cn" target="_blank">久久这里只有精品视频99</a>| <a href="http://www.988o.cn" target="_blank">精品久久久无码中文字幕 </a>| <a href="http://www.710p.cn" target="_blank">免费观看久久精彩视频</a>| <a href="http://www.tjyizhao.cn" target="_blank">久久国产热精品波多野结衣AV</a>| <a href="http://www.shidaqizhong.cn" target="_blank">精品久久久无码21p发布</a>| <a href="http://www.2bseo.cn" target="_blank">波多野结衣久久精品</a>| <a href="http://www.9xz.com.cn" target="_blank">模特私拍国产精品久久</a>| <a href="http://www.suvvoza.cn" target="_blank">色综合合久久天天给综看</a>| <a href="http://www.vbzc.cn" target="_blank">国产精品久久久久久久久软件</a>| <a href="http://www.xinkecheng.net.cn" target="_blank">性高湖久久久久久久久AAAAA</a>| <a href="http://www.anglein.cn" target="_blank">久久天天躁狠狠躁夜夜av浪潮</a>| <a href="http://www.88ye.cn" target="_blank">久久久久亚洲AV成人网人人网站 </a>| <a href="http://www.yixue77.cn" target="_blank">久久精品国产色蜜蜜麻豆</a>| <a href="http://www.bash001.cn" target="_blank">久久久精品日本一区二区三区</a>| <a href="http://www.gx177.cn" target="_blank">亚洲性久久久影院</a>| <a href="http://www.vxbw.cn" target="_blank">日韩人妻无码精品久久久不卡</a>| <a href="http://www.fa808.cn" target="_blank">久久AV高清无码</a>| <a href="http://www.vdmo.cn" target="_blank">久久av免费天堂小草播放</a>| <a href="http://www.xsoczv19.cn" target="_blank">2021国内精品久久久久久影院</a>| <a href="http://www.fyhd.net.cn" target="_blank">亚洲精品国精品久久99热一</a>| <a href="http://www.bestlevering.cn" target="_blank">日日噜噜夜夜狠狠久久丁香五月 </a>| <a href="http://www.xa-dwyer.cn" target="_blank">久久久91人妻无码精品蜜桃HD</a>| <a href="http://www.hz-yarnexpo.com.cn" target="_blank">久久精品国产亚洲一区二区三区</a>| <a href="http://www.caipusheji2016.cn" target="_blank">色婷婷狠狠久久综合五月</a>| <a href="http://www.aurp.cn" target="_blank">久久综合精品国产二区无码</a>| <a href="http://www.0352quan.cn" target="_blank">久久无码av三级</a>| <a href="http://www.the-music-cable.cn" target="_blank">偷窥少妇久久久久久久久</a>| <a href="http://www.aipmusic.cn" target="_blank">国产精品一久久香蕉产线看</a>| <a href="http://www.sansiwu.cn" target="_blank">久久久久亚洲精品男人的天堂</a>| <a href="http://www.bpdb.com.cn" target="_blank">亚洲AV无码久久精品成人 </a>| <a href="http://www.xiewanliang.cn" target="_blank">久久午夜伦鲁片免费无码</a>| <a href="http://www.obsessions.cn" target="_blank">伊人久久综在合线亚洲2019</a>| <a href="http://www.ixdsw.cn" target="_blank">久久婷婷五月综合国产尤物app</a>| <a href="http://www.111net.org.cn" target="_blank">2021少妇久久久久久久久久</a>| <a href="http://www.168zw.cn" target="_blank">一97日本道伊人久久综合影院</a>| <a href="http://www.cqhthj.com.cn" target="_blank">国产精品久久亚洲不卡动漫</a>| <a href="http://www.guangmingtyre.cn" target="_blank">色综合久久夜色精品国产</a>| <script> (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })(); </script> </body>