<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress.com" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>winapi &amp;laquo; WordPress.com Tag Feed</title>
	<link>http://en.wordpress.com/tag/winapi/</link>
	<description>Feed of posts on WordPress.com tagged "winapi"</description>
	<pubDate>Mon, 30 Nov 2009 19:55:24 +0000</pubDate>

	<generator>http://en.wordpress.com/tags/</generator>
	<language>en</language>

<item>
<title><![CDATA[Wreszcie]]></title>
<link>http://paaavl0.wordpress.com/2009/11/07/wreszcie/</link>
<pubDate>Sat, 07 Nov 2009 18:46:25 +0000</pubDate>
<dc:creator>Paweł</dc:creator>
<guid>http://paaavl0.wordpress.com/2009/11/07/wreszcie/</guid>
<description><![CDATA[http://nopaste.gamedev.pl/?id=4746 &#8211; program, w którym rysujemy ścieżkę ruchu dla Spybot]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p><a href="http://nopaste.gamedev.pl/?id=4746">http://nopaste.gamedev.pl/?id=4746</a> &#8211; program, w którym rysujemy ścieżkę ruchu dla Spybot&#8217;a &#8211; Tracker&#8217;a. Zapisuje on wynik w pliku nagłówkowym <em>.nqh</em>, jako dwie tablice zawierające kąty i odległości. Elementy tablic, zgodnie z językiem NQC, nie mogą być inicjowane z poziomu programisty, stąd funkcja <em>initiate()</em>.</p>
<p>Obrót zgodny z ruchem wskazówek zegara jest oznaczany jako dodatni, przeciwny jako ujemny. Kąt obrotu nigdy nie może być większy od 180°. Jest to zasługa tego fragmentu:</p>
<pre style="padding-left:30px;">if (fOrientation &#62; fAngle)
{
    if (fOrientation - fAngle &#60;= 180)
        fTurnAngle = fOrientation - fAngle ;
    else
        fTurnAngle = -1 * (360 - fOrientation + fAngle) ;
}
else if (fOrientation &#60; fAngle)
{
    if (fAngle - fOrientation &#60;= 180)
        fTurnAngle = - (fAngle - fOrientation) ;
    else
        fTurnAngle = 360 - fAngle + fOrientation ;
}
else fTurnAngle = 0 ;</pre>
<p>Drugi program, napisany w NQC jest uruchamiany osobno, po podłączeniu robota do komputera. Dołącza plik nagłówkowy z danymi, jest bardzo prosty w budowie: <a href="http://nopaste.gamedev.pl/?id=4747">http://nopaste.gamedev.pl/?id=4747</a></p>
<p>Problemem jest to, że nie znalazłem funkcji odpowiadającej za zwolnienie silników, przez co robot jest niedokładny. Obrót robota jest mierzony w centysekundach (1/100s = 1cs), a nie w stopniach, czy chociaż radianach.  W dodatku system robota nie obsługuje liczb innych niż całkowite. Kolejnym ograniczeniem jest pamięć robota, która może przechować jedynie 15 waypoint&#8217;ów.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Mendapatkan Folder-Folder Spesial dan Informasi Windows (Delphi)]]></title>
<link>http://alf4vian.wordpress.com/2009/10/29/mendapatkan-folder-folder-spesial-dan-informasi-windows-delphi/</link>
<pubDate>Thu, 29 Oct 2009 15:47:46 +0000</pubDate>
<dc:creator>alf4vian</dc:creator>
<guid>http://alf4vian.wordpress.com/2009/10/29/mendapatkan-folder-folder-spesial-dan-informasi-windows-delphi/</guid>
<description><![CDATA[Sistem operasi Windows menawarkan banyak kemudahan bukan hanya bagi pengguna tetapi juga bagi progra]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Sistem operasi Windows menawarkan banyak kemudahan bukan hanya bagi pengguna tetapi juga bagi programmer. Kemudahan tersebut dikarenakan windows mempunyai banyak fungsi-fungsi <strong>API</strong> (<em>Application Programming Interface</em>) yang bisa dimanfaatkan. Fungsi-fungsi tersebut biasanya dinamakan <strong>WinAPI</strong>.</p>
<p>Beberapa fungsi<strong> WinAPI</strong> yang biasanya digunakan adalah untuk mendapatkan lokasi folder-folder spesial atau folder-folder khusus milik Windows dan mendapatkan beberapa informasi Windows.</p>
<p><!--more--></p>
<p>Yang dimaksud dengan folder-folder spesial misalnya adalah folder <strong>system32</strong>, <strong>windows</strong>, <strong>start menu</strong>, <strong>program files</strong>, <strong>my documents</strong> dll. Sedangkan informasi windows diantaranya nama komputer, nama user yang sedang aktif, prosessor yang digunakan dll.</p>
<p>OK, tanpa banyak basa-basi lagi langsung kita luncurkan <strong>Delphi</strong> kesayangan kita…</p>
<p>Pertama buat form seperti berikut:</p>
<p><img class="alignnone size-full wp-image-10" title="fspesial1" src="http://alf4vian.wordpress.com/files/2009/10/fspesial1.png" alt="fspesial1" width="447" height="443" /></p>
<p>Berikutnya program pada <strong>Button1</strong> (Get All) event <strong>OnClick</strong>:</p>
<pre>procedure TForm1.Button1Click(Sender: TObject);
var
pId : PItemIDList;
dir : array[0..MAX_PATH] of char;
len : Cardinal;
begin
//Untuk mendapatkan drive tempat instalasi windows
GetEnvironmentVariable('SystemDrive', @dir, MAX_PATH);
Edit1.Text := String(dir);

//Untuk mendapatkan lokasi folder windows
GetWindowsDirectory(@dir, MAX_PATH);
Edit2.Text := String(dir);

//Untuk mendapatkan lokasi folder system32
GetSystemDirectory(@dir, MAX_PATH);
Edit3.Text := String(dir);

//Untuk mendapatkan lokasi folder Program Files
GetEnvironmentVariable('ProgramFiles', @dir, MAX_PATH);
Edit4.Text := String(dir);

//Untuk mendapatkan lokasi folder Desktop untuk semua user
SHGetSpecialFolderLocation(Handle, CSIDL_COMMON_DESKTOPDIRECTORY, pId);
SHGetPathFromIDList(pId, dir);
Edit5.Text := String(dir);

//Untuk mendapatkan lokasi folder Desktop untuk user yang aktif
SHGetSpecialFolderLocation(Handle, CSIDL_DESKTOPDIRECTORY, pId);
SHGetPathFromIDList(pId, dir);
Edit6.Text := String(dir);

//Untuk mendapatkan lokasi folder Start Menu untuk semua user
SHGetSpecialFolderLocation(Handle, CSIDL_COMMON_STARTMENU, pId);
SHGetPathFromIDList(pId, dir);
Edit7.Text := String(dir);

//Untuk mendapatkan lokasi folder Start Menu untuk user yang aktif
SHGetSpecialFolderLocation(Handle, CSIDL_STARTMENU, pId);
SHGetPathFromIDList(pId, dir);
Edit8.Text := String(dir);

//Untuk mendapatkan nama komputer
len := MAX_COMPUTERNAME_LENGTH + 1;
GetComputerName(@dir, len);
Edit9.Text := String(dir);

//Untuk mendapatkan nama user yang sedang login
len := 255;
GetUserName(@dir, len);
Edit10.Text := String(dir);

//Untuk mendapatkan lokasi folder Document dari user yang aktif
SHGetSpecialFolderLocation(Handle, CSIDL_PERSONAL, pId);
SHGetPathFromIDList(pId, dir);
Edit11.Text := String(dir);

//Untuk mendapatkan informasi jumlah prosessor yang digunakan
GetEnvironmentVariable('NUMBER_OF_PROCESSORS', @dir, MAX_PATH);
Edit12.Text := String(dir);

//Untuk mendapatkan informasi nama prosessor yang digunakan
GetEnvironmentVariable('PROCESSOR_IDENTIFIER', @dir, MAX_PATH);
Edit13.Text := String(dir);

//Untuk mendapatkan informasi nama OS yang digunakan
GetEnvironmentVariable('OS', @dir, MAX_PATH);
Edit14.Text := String(dir);

//Untuk mendapatkan informasi resolusi layar
Edit15.Text := IntToStr(GetSystemMetrics(SM_CXSCREEN)) +
' x ' +
IntToStr(GetSystemMetrics(SM_CYSCREEN));
end;</pre>
<p>Hasil setelah running:</p>
<p><img class="alignnone size-full wp-image-11" title="fspesial2" src="http://alf4vian.wordpress.com/files/2009/10/fspesial2.png" alt="fspesial2" width="477" height="473" /></p>
<p>Fungsi-fungsi tersebut hanya sebagian kecil saja hasil explorasi saya pribadi, masih banyak fungsi-fungsi yang lainnya yang belum saya <em>explore </em>karena keterbatasan waktu. Untuk itu silahkan Anda mencarinya lewat tutorial-tutorial yang banyak tersebar di belantara Internet.</p>
<p>Atau bagi anda yang berkeinginan untuk mengembara di “hutan” <strong>WinAPI</strong> silahkan baca manual dari Windows API.</p>
<p><a title="Download script" href="http://www.4shared.com/file/144671280/a40398b4/folder-spesial1.html" target="_blank">Download script</a></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[]]></title>
<link>http://theroadtodelphi.wordpress.com/2009/10/18/209/</link>
<pubDate>Sun, 18 Oct 2009 21:11:04 +0000</pubDate>
<dc:creator>Rodrigo</dc:creator>
<guid>http://theroadtodelphi.wordpress.com/2009/10/18/209/</guid>
<description><![CDATA[Using the Native API function NtQuerySystemInformation you can list all open handles from all proces]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Using the Native API function <a rel="nofollow" href="http://msdn.microsoft.com/en-us/library/ms724509%28VS.85%29.aspx">NtQuerySystemInformation</a> you can list all open handles from all processes.</p>
<pre class="brush: delphi;">

program ListAllOpenHandles;

{$APPTYPE CONSOLE}

uses
  PSApi,
  Windows,
  SysUtils;

const
SystemHandleInformation       = $10;
STATUS_SUCCESS        	      = $00000000;
STATUS_BUFFER_OVERFLOW        = $80000005;
STATUS_INFO_LENGTH_MISMATCH   = $C0000004;
DefaulBUFFERSIZE              = $100000;

type
 OBJECT_INFORMATION_CLASS = (ObjectBasicInformation,ObjectNameInformation,ObjectTypeInformation,ObjectAllTypesInformation,ObjectHandleInformation );

 SYSTEM_HANDLE=packed record
	uIdProcess:ULONG;
	ObjectType:UCHAR;
	Flags     :UCHAR;
	Handle    :Word;
	pObject   : Pointer;
	GrantedAccess:ACCESS_MASK;
 end;

 PSYSTEM_HANDLE      = ^SYSTEM_HANDLE;
 SYSTEM_HANDLE_ARRAY = Array[0..0] of SYSTEM_HANDLE;
 PSYSTEM_HANDLE_ARRAY= ^SYSTEM_HANDLE_ARRAY;

  SYSTEM_HANDLE_INFORMATION=packed record
	uCount:ULONG;
	Handles:SYSTEM_HANDLE_ARRAY;
 end;
 PSYSTEM_HANDLE_INFORMATION=^SYSTEM_HANDLE_INFORMATION;

 TNtQuerySystemInformation=function (SystemInformationClass:DWORD; SystemInformation: pointer; SystemInformationLength:DWORD;  ReturnLength:PDWORD):THandle; stdcall;
 TNtQueryObject           =function (ObjectHandle:cardinal; ObjectInformationClass:OBJECT_INFORMATION_CLASS; ObjectInformation: pointer; Length:ULONG;ResultLength:PDWORD):THandle;stdcall;

 UNICODE_STRING=packed record
    Length       :Word;
    MaximumLength:Word;
    Buffer       : PWideChar;
 end;

 OBJECT_NAME_INFORMATION=UNICODE_STRING;
 POBJECT_NAME_INFORMATION=^OBJECT_NAME_INFORMATION;

Var
 NTQueryObject           :TNtQueryObject;
 NTQuerySystemInformation:TNTQuerySystemInformation;

function GetObjectInfo(hObject:cardinal; objInfoClass:OBJECT_INFORMATION_CLASS):LPWSTR;
var
 pObjectInfo:POBJECT_NAME_INFORMATION;
 HDummy     :THandle;
 dwSize     : DWORD;
begin
  Result:=nil;
		dwSize      := sizeof(OBJECT_NAME_INFORMATION);
		pObjectInfo := AllocMem(dwSize);
		HDummy      := NTQueryObject(hObject, objInfoClass, pObjectInfo,dwSize, @dwSize);

		if((HDummy = STATUS_BUFFER_OVERFLOW) or (HDummy = STATUS_INFO_LENGTH_MISMATCH)) then
    begin
			FreeMem(pObjectInfo);
			pObjectInfo := AllocMem(dwSize);
			HDummy      := NTQueryObject(hObject, objInfoClass, pObjectInfo,dwSize, @dwSize);
		end;

		if((HDummy &#62;= STATUS_SUCCESS) and (pObjectInfo.Buffer &#60;&#62; nil)) then
		begin
			Result := AllocMem(pObjectInfo.Length + sizeof(WCHAR));
			CopyMemory(result, pObjectInfo.Buffer, pObjectInfo.Length);
		end;
		FreeMem(pObjectInfo);
end;

procedure EnumerateOpenFiles();
var
 sDummy      : string;
 hProcess    : THandle;
 hObject     : THandle;
 ResultLength: DWORD;
 aBufferSize : DWORD;
 aIndex      : Integer;
 pHandleInfo : PSYSTEM_HANDLE_INFORMATION;
 HDummy      : THandle;
 lpwsName    : PWideChar;
 lpwsType    : PWideChar;
 lpszProcess : PAnsiChar;
begin
    AbufferSize      := DefaulBUFFERSIZE;
		pHandleInfo      := AllocMem(AbufferSize);
		HDummy           := NTQuerySystemInformation(DWORD(SystemHandleInformation), pHandleInfo,AbufferSize, @ResultLength);  //Get the list of handles

		if(HDummy = STATUS_SUCCESS) then  //If no error continue
    begin

      for aIndex:=0 to pHandleInfo^.uCount-1 do   //iterate the list
      begin
				hProcess := OpenProcess(PROCESS_DUP_HANDLE or PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, FALSE, pHandleInfo.Handles[aIndex].uIdProcess);  //open the process to get aditional info
				if(hProcess &#60;&#62; INVALID_HANDLE_VALUE) then  //Check valid handle
        begin
					hObject := 0;
					if DuplicateHandle(hProcess, pHandleInfo.Handles[aIndex].Handle,GetCurrentProcess(), @hObject, STANDARD_RIGHTS_REQUIRED,FALSE, 0) then  //Get  a copy of the original handle
          begin
						lpwsName := GetObjectInfo(hObject, ObjectNameInformation); //Get the filename linked to the handle
						if (lpwsName &#60;&#62; nil)  then
            begin
							lpwsType    := GetObjectInfo(hObject, ObjectTypeInformation);
							lpszProcess := AllocMem(MAX_PATH);

							if GetModuleFileNameEx(hProcess, 0,lpszProcess, MAX_PATH)&#60;&#62;0 then  //get the name of the process
               sDummy:=ExtractFileName(lpszProcess)
              else
               sDummy:= 'System Process';

              Writeln('PID      ',pHandleInfo.Handles[aIndex].uIdProcess);
              Writeln('Handle   ',pHandleInfo.Handles[aIndex].Handle);
              Writeln('Process  ',sDummy);
              Writeln('FileName ',string(lpwsName));
              Writeln;

              FreeMem(lpwsName);
              FreeMem(lpwsType);
              FreeMem(lpszProcess);
						end;
						CloseHandle(hObject);
					end;
					CloseHandle(hProcess);
				end;
			end;
		end;
		FreeMem(pHandleInfo);

end;

begin
  try
    NTQueryObject            := GetProcAddress(GetModuleHandle('NTDLL.DLL'), 'NtQueryObject');
    NTQuerySystemInformation := GetProcAddress(GetModuleHandle('NTDLL.DLL'), 'NtQuerySystemInformation');
  	if (@NTQuerySystemInformation&#60;&#62;nil) and (@NTQuerySystemInformation&#60;&#62;nil) then
    EnumerateOpenFiles();
    Readln;
  except
    on E:Exception do
      Writeln(E.Classname, ': ', E.Message);
  end;
end.
</pre>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Обернул ScrollBar]]></title>
<link>http://miksayer.wordpress.com/2009/09/22/%d0%be%d0%b1%d0%b5%d1%80%d0%bd%d1%83%d0%bb-scrollbar/</link>
<pubDate>Tue, 22 Sep 2009 19:41:59 +0000</pubDate>
<dc:creator>miksayer</dc:creator>
<guid>http://miksayer.wordpress.com/2009/09/22/%d0%be%d0%b1%d0%b5%d1%80%d0%bd%d1%83%d0%bb-scrollbar/</guid>
<description><![CDATA[Вот обернул ScrollBar в класс. Реализовывалось под свои нужды, поэтому работа ведется только со стан]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Вот обернул ScrollBar в класс. Реализовывалось под свои нужды, поэтому работа ведется только со стандартными скроллбарами контролов(т.е. с вертикальным, горизонтальным или сразу с обоими). Выкладываю код:</p>
<pre class="brush: cpp;">
class ScrollBar : Window
{
public:
	ScrollBar(HWND hParent)
	{
		_hParent = hParent;
	}

	void enableScrollBar(UINT wSBflags, UINT wArrows)
	{
		::EnableScrollBar(_hParent, wSBflags, wArrows);
	}

	void getScrollBarInfo(LONG idObject, PSCROLLBARINFO psbi)
	{
		::GetScrollBarInfo(_hParent, idObject, psbi);
	}

	void getScrollInfo(int fnBar, LPSCROLLINFO lpsi)
	{
		::GetScrollInfo(_hParent, fnBar, lpsi);
	}

	void scrollWindow(int dx, int dy, const RECT *prcScroll, UINT flags)
	{
		::ScrollWindowEx(_hParent, dx, dy, prcScroll, NULL, NULL, NULL, flags);
	}

	void setScrollInfo(int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw = TRUE)
	{
		::SetScrollInfo(_hParent, fnBar, lpsi, fRedraw);
	}

	void showScrollBar(int wBar, BOOL bShow = TRUE)
	{
		::ShowScrollBar(_hParent, wBar, bShow);
	}

	static WORD getScrollingReguest(WPARAM wParam)
	{
		return LOWORD(wParam);
	}

};
</pre>
<p>В принципе дополнить класс для работы со скроллбаром как с отдельным контролом не проблема, может быть как-нибудь займусь(что там заниматься: пару строчек дописать и все <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[LEGO? Dlaczego nie.]]></title>
<link>http://paaavl0.wordpress.com/2009/09/18/lego-dlaczego-nie/</link>
<pubDate>Fri, 18 Sep 2009 17:02:34 +0000</pubDate>
<dc:creator>Paweł</dc:creator>
<guid>http://paaavl0.wordpress.com/2009/09/18/lego-dlaczego-nie/</guid>
<description><![CDATA[Kilka dni temu znalazłem starego Spybota w moim zbiorze &#8220;Technic&#8217;sów&#8221;. Kto się tym]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Kilka dni temu znalazłem starego Spybota w moim zbiorze &#8220;Technic&#8217;sów&#8221;. Kto się tym bawił ten wie co to jest, a kto nie&#8230; niech łapie <a href="http://en.wikipedia.org/wiki/Lego_Spybotics">linka</a> <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
Robotowi można wgrywać różne misje z dostarczonego w zestawie CD-ROM&#8217;u (którego nie mam), ale można też programować go w konwencjonalny sposób. Wykorzystując język NQC (Not Quite C).<br />
Mam już klika pomysłów na wykorzystanie modułu, ale niestety dużym ograniczeniem jest to, że posiada on tylko dwa silniki (w dodatku zamontowane na stałe), czujnik dotykowy i marnej jakości czujnik optyczny. Na początek pobawię się z tym co mam, a jeśli mnie wciągnie to może pomyślę nad zakupem nowszych komputerów od LEGO o znacznie większych możliwościach. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Wszystko byłoby super, gdyby nie to, że szkoła zajmuje mi bardzo dużo czasu. :/ Dlatego też nie mogę powiedzieć kiedy zacznę pisać nową wersję mojego &#8216;malarza kodu&#8217; z wykorzystaniem WinAPI.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Header Control Class]]></title>
<link>http://miksayer.wordpress.com/2009/09/14/header-control-class/</link>
<pubDate>Mon, 14 Sep 2009 18:32:16 +0000</pubDate>
<dc:creator>miksayer</dc:creator>
<guid>http://miksayer.wordpress.com/2009/09/14/header-control-class/</guid>
<description><![CDATA[Написал оберточку над хедером: class Header : public Window { public: Header(HWND hParent, HINSTANCE]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Написал оберточку над хедером:</p>
<pre class="brush: cpp;">
class Header : public Window
{
public:

	Header(HWND hParent, HINSTANCE hInst)
	{
		RECT rcParent;
		HDLAYOUT hdl;
		WINDOWPOS wp;
		::InitCommonControls(); 

		_hSelf = ::CreateWindowEx(0, WC_HEADER, (LPCTSTR) NULL,
								  WS_CHILD &amp;#124; HDS_BUTTONS &amp;#124;  HDS_HORZ &amp;#124; WS_BORDER,
								  0, 0, 0, 0, hParent, 0, _hInst,
								  (LPVOID) NULL);
		HFONT hDefaultFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
		::SendMessage(_hSelf,WM_SETFONT,(WPARAM)hDefaultFont,0);
		::GetClientRect(hParent, &amp;rcParent); 

		hdl.prc = &amp;rcParent;
		hdl.pwpos = &amp;wp;
		::SendMessage(_hSelf, HDM_LAYOUT, 0, (LPARAM) &amp;hdl);
		::SetWindowPos(_hSelf, wp.hwndInsertAfter, wp.x, wp.y,
			wp.cx, wp.cy, wp.flags &amp;#124; SWP_SHOWWINDOW);
	};

	int insertItem(int iInsertAfter, int nWidth, LPWSTR lpsz)
	{
		HDITEM hdi;
		int index; 

		hdi.mask = HDI_TEXT &amp;#124; HDI_FORMAT &amp;#124; HDI_WIDTH;
		hdi.pszText = lpsz;
		hdi.cxy = nWidth;
		hdi.cchTextMax = wcslen(lpsz);
		hdi.fmt = HDF_LEFT &amp;#124; HDF_STRING; 

		index = SendMessage(_hSelf, HDM_INSERTITEM,
			(WPARAM) iInsertAfter, (LPARAM) &amp;hdi);
		return index;
	} 

	int getHeight()
	{
		RECT rc;
		::SendMessage(_hSelf, HDM_GETITEMRECT, 0, (LPARAM)&amp;rc);
		return rc.bottom;
	}
};
</pre>
<p>Несколько замечаний по этому поводу:</p>
<ul>
<li>Код практически слизан с примеров из MSDN(этого практически нельзя было не сделать, т.к. &#8220;есть два вида программирования на WinApi: так, как в MSDN и неправильно&#8221; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</li>
<li>Не забывайте из оконной процедуры родительского окна хедера возвращать по умолчанию FALSE(это чревато непонятными глюками)</li>
<li>Реализовно естественно далеко не все, но необходимый мне минимум(если кому надо, то MSDN в руки и пошел)</li>
</ul>
<p>Вообще сейчас как-то давно не брался ни за свой менеджер, ни за контрол для него, т.к. сейчас мало времени</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Некоторые соображения]]></title>
<link>http://miksayer.wordpress.com/2009/09/07/%d0%bd%d0%b5%d0%ba%d0%be%d1%82%d0%be%d1%80%d1%8b%d0%b5-%d1%81%d0%be%d0%be%d0%b1%d1%80%d0%b0%d0%b6%d0%b5%d0%bd%d0%b8%d1%8f/</link>
<pubDate>Mon, 07 Sep 2009 18:58:11 +0000</pubDate>
<dc:creator>miksayer</dc:creator>
<guid>http://miksayer.wordpress.com/2009/09/07/%d0%bd%d0%b5%d0%ba%d0%be%d1%82%d0%be%d1%80%d1%8b%d0%b5-%d1%81%d0%be%d0%be%d0%b1%d1%80%d0%b0%d0%b6%d0%b5%d0%bd%d0%b8%d1%8f/</guid>
<description><![CDATA[Решил писать контрол с нуля. Учитывая специфику приложения вот, что я думаю сделать: 1. Завести конт]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Решил писать контрол с нуля. Учитывая специфику приложения вот, что я думаю сделать:<br />
1. Завести контейнер, где я буду хранить все узлы контрола. Узел будет иметь следующий вид:</p>
<pre class="brush: cpp;">
struct node
{
    nodeinfo * ii; //вся информация, которая хранится в узле
    int level; //уровень
}
</pre>
<p>Отрисовывать я буду в цикле, просто смещая каждый узел на itm-&#62;level * someConst влево. Получится своеобразнае дерево. Просто здесь мне так можно сделать, т.к. дочерние узлы у меня в любом случае будут добавляться сразу после родительских<br />
2. Выделение и раскрытие\закрытие узлов буду делать немного извращенно: просто ловить WM_LBUTTONDOWN, определять по координатам выбранный узел, производить изменения, потом перерисовывать контрол<br />
3. Естественно буду использовать header control и scroll bar, логику которых придется писать полностью самостоятельно</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Изменения в интерфейсе]]></title>
<link>http://miksayer.wordpress.com/2009/09/04/%d0%b8%d0%b7%d0%bc%d0%b5%d0%bd%d0%b5%d0%bd%d0%b8%d1%8f-%d0%b2-%d0%b8%d0%bd%d1%82%d0%b5%d1%80%d1%84%d0%b5%d0%b9%d1%81%d0%b5/</link>
<pubDate>Fri, 04 Sep 2009 13:08:16 +0000</pubDate>
<dc:creator>miksayer</dc:creator>
<guid>http://miksayer.wordpress.com/2009/09/04/%d0%b8%d0%b7%d0%bc%d0%b5%d0%bd%d0%b5%d0%bd%d0%b8%d1%8f-%d0%b2-%d0%b8%d0%bd%d1%82%d0%b5%d1%80%d1%84%d0%b5%d0%b9%d1%81%d0%b5/</guid>
<description><![CDATA[Решил изменить интерфейс для более удобной настройки горячих клавиш. Для этого необходимо реализоват]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Решил изменить интерфейс для более удобной настройки горячих клавиш. Для этого необходимо реализовать контрол, который часто называют TreeListView(т.е. скрещенный ListView и TreeView) на WinApi(что является достаточно сложной работой). В результате должно получится что-то вроде этого:<br />
<img src="http://miksayer.wordpress.com/files/2009/09/treelistview_1.gif" alt="TreeListView" title="TreeListView" width="408" height="232" class="aligncenter size-full wp-image-86" /><br />
Буду делать <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[О квадратиках, кружочках и треугольничках]]></title>
<link>http://miksayer.wordpress.com/2009/08/22/%d0%be-%d0%ba%d0%b2%d0%b0%d0%b4%d1%80%d0%b0%d1%82%d0%b8%d0%ba%d0%b0%d1%85-%d0%ba%d1%80%d1%83%d0%b6%d0%be%d1%87%d0%ba%d0%b0%d1%85-%d0%b8-%d1%82%d1%80%d0%b5%d1%83%d0%b3%d0%be%d0%bb%d1%8c%d0%bd%d0%b8/</link>
<pubDate>Fri, 21 Aug 2009 22:13:13 +0000</pubDate>
<dc:creator>miksayer</dc:creator>
<guid>http://miksayer.wordpress.com/2009/08/22/%d0%be-%d0%ba%d0%b2%d0%b0%d0%b4%d1%80%d0%b0%d1%82%d0%b8%d0%ba%d0%b0%d1%85-%d0%ba%d1%80%d1%83%d0%b6%d0%be%d1%87%d0%ba%d0%b0%d1%85-%d0%b8-%d1%82%d1%80%d0%b5%d1%83%d0%b3%d0%be%d0%bb%d1%8c%d0%bd%d0%b8/</guid>
<description><![CDATA[Решил добавить в ListBox&#8217;е со списком плагинов к каждому элементу кнопочку для вызова настроек]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Решил добавить в ListBox&#8217;е со списком плагинов к каждому элементу кнопочку для вызова настроек плагина(если она необходима). Решил рисовать ее сам(поверьте, так меньше геммороя):</p>
<pre class="brush: cpp;">
if (plugin-&gt;isNeedSettings())
{
	HTHEME hTheme = ::OpenThemeData(_hSelf, L&quot;Button&quot;);
	rc.left = 280;
	rc.top += 5;
	rc.right = 360;
	rc.bottom -=35;
	if (IsThemeActive())
	{
		if (pushed &amp;&amp; (lpdis-&gt;itemState &amp; ODS_SELECTED))
			::DrawThemeBackground(hTheme, lpdis-&gt;hDC, BP_PUSHBUTTON, PBS_PRESSED, &amp;rc, NULL);
		else
			::DrawThemeBackground(hTheme, lpdis-&gt;hDC, BP_PUSHBUTTON, PBS_NORMAL, &amp;rc, NULL);
		::DrawThemeText(hTheme, lpdis-&gt;hDC, BP_PUSHBUTTON, PBS_NORMAL, L&quot;Settings...&quot;, wcslen(L&quot;Settings...&quot;), DT_SINGLELINE &amp;#124; DT_VCENTER &amp;#124; DT_CENTER, 0, &amp;rc);
	}
	else
	{
		if (pushed &amp;&amp; (lpdis-&gt;itemState &amp; ODS_SELECTED))
			::DrawFrameControl(lpdis-&gt;hDC, &amp;rc, DFC_BUTTON, DFCS_BUTTONPUSH &amp;#124; DFCS_PUSHED);
		else
			::DrawFrameControl(lpdis-&gt;hDC, &amp;rc, DFC_BUTTON, DFCS_BUTTONPUSH);
		::DrawText(lpdis-&gt;hDC, L&quot;Settings...&quot;, wcslen(L&quot;Settings...&quot;), &amp;rc, DT_CENTER);
	}
	::CloseThemeData(hTheme);
}
</pre>
<p>Казалось бы все должно отрисоваться, как надо, однако вот, что получается при классической теме Windows(в других все нормально):<br />
<img class="aligncenter size-full wp-image-63" title="Квадратики, кружочки :-)" src="http://miksayer.wordpress.com/files/2009/08/oihotkey1.jpg" alt="Квадратики, кружочки :-)" width="380" height="410" /><br />
В общем, нужно разбираться<br />
Кстати, добавлена иконка в трее, поработал над диалогом настроек программы. Написал себе корявенькое TODO на ближайшее время:</p>
<ul>
<li>Реализовать OSD-сообщения для плагинов(ну, и сама программа может будет их использовать) &#8211; даже не брался</li>
<li>Реализовать диалог настроек и их чтение/запись &#8211; сам диалог уже работает(там просто была идиотская ошибка, из-за которой у меня неделю не получалось нормально его сделать), осталось чтение/запись</li>
<li>Кнопки на листбоксе(и не только для вызова настроек плагина) &#8211; почти сделано(проблема описана выше)</li>
</ul>
<p>Как все это доделаю, думаю, можно будет бету выдать в свет <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Porządki]]></title>
<link>http://paaavl0.wordpress.com/2009/08/10/porzadki/</link>
<pubDate>Mon, 10 Aug 2009 13:28:58 +0000</pubDate>
<dc:creator>Paweł</dc:creator>
<guid>http://paaavl0.wordpress.com/2009/08/10/porzadki/</guid>
<description><![CDATA[Postanowiłem zrobić porządek ze sobą i na blogu. Wiem&#8230; to dziwnie brzmi Ale do rzeczy. Do tej ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Postanowiłem zrobić porządek ze sobą i na blogu. Wiem&#8230; to dziwnie brzmi <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Ale do rzeczy. Do tej pory moje zainteresowanie programowaniem przypominało taką&#8230; jakby to nazwać&#8230; O! sinusoidę, właśnie. Od teraz mam zamiar regularnie zgłębiać moją wiedzę na ten temat, choć wiem, że może być to trudniejsze. Śpieszę z wyjaśnieniem &#8211; od września zaczynam naukę w liceum. Nie wiem jak będzie&#8230; nowi ludzie, nowi znajomi, mniej czasu&#8230; cóż, pożyjemy zobaczymy.</p>
<p>Co do sprawy bloga. Chciałem po prostu odświeżyć linki i zmienić wygląd, bo ten niebieski top mi się znudził. Niestety w tej chwili nie mam dostępu do mojego dysku twardego na PeCecie &#8211; wysłałem kartę graficzną do serwisu miesiąc temu , no i jeszcze się ślimory nie wyrobiły. :/<br />
Tak więc nowy upload zrobię za tydzień, może dwa.</p>
<p>Wkrótce planuję wypuścić na świat nową wersję mojego Koloryzatora Składni &#8211; tym razem w wersji graficznej z wykorzystaniem WinAPI. Muszę tylko zgłębić wiedzę o okienkach. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[WinAPI ;)]]></title>
<link>http://paaavl0.wordpress.com/2009/08/10/winapi/</link>
<pubDate>Mon, 10 Aug 2009 13:13:40 +0000</pubDate>
<dc:creator>Paweł</dc:creator>
<guid>http://paaavl0.wordpress.com/2009/08/10/winapi/</guid>
<description><![CDATA[Witam, kilka dni temu zamówiłem sobie podręcznik: Programowanie Windows Charlesa Petzold&#8217;a]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Witam, kilka dni temu zamówiłem sobie podręcznik: <em>Programowanie Windows</em> Charlesa Petzold&#8217;a&#8230;</p>
<p>Od tamtej pory nic, tylko siedzę przed laptopem z książką w ręku. Nauczyłem się już trochę i mam na dysku kilka malutkich programów, ale ciekawych <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Muszę przyznać, że dowiedziałem się sporo na temat samego działania systemu, jego architektury i rozwoju. Polecam tą publikację wszystkim, którzy jeszcze nie mieli kontaktu z WinAPI, a także zaawansowanym programistom. Tam zebrana jest znaczna część danych z msdn i w dodatku opisana po polsku zrozumiałym językiem.</p>
<p>Wszystkie kursy internetowe przy tym podręczniku wypadają conajmniej słabo. Jeszcze raz polecam, mimo niemałej cenki.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Find out Size (and position) of the taskbar]]></title>
<link>http://winsharp93.wordpress.com/2009/06/29/find-out-size-and-position-of-the-taskbar/</link>
<pubDate>Mon, 29 Jun 2009 12:22:24 +0000</pubDate>
<dc:creator>winsharp93</dc:creator>
<guid>http://winsharp93.wordpress.com/2009/06/29/find-out-size-and-position-of-the-taskbar/</guid>
<description><![CDATA[What size is the taskbar on this computer? And where is it at all? This post has the answer. A commo]]></description>
<content:encoded><![CDATA[What size is the taskbar on this computer? And where is it at all? This post has the answer. A commo]]></content:encoded>
</item>
<item>
<title><![CDATA[Win32 API Reference - Cẩm Nang Tra Cứu WinAPI Bỏ Túi]]></title>
<link>http://fri3ng3r.wordpress.com/2009/06/29/win32-api-reference-cam-nang-tra-cuu-winapi-bo-tui/</link>
<pubDate>Mon, 29 Jun 2009 01:49:48 +0000</pubDate>
<dc:creator>Fri3ng3R</dc:creator>
<guid>http://fri3ng3r.wordpress.com/2009/06/29/win32-api-reference-cam-nang-tra-cuu-winapi-bo-tui/</guid>
<description><![CDATA[Win32 API Reference Cẩm Nang Tra Cứu WinAPI Bỏ Túi Ban đầu, Fri3ng3R tính dịch các hàm và các kiểu d]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:center;"><span style="font-weight:bold;font-size:medium;"><span style="font-family:Verdana;">Win32 API Reference<br />
Cẩm Nang Tra Cứu WinAPI Bỏ Túi</span></span></p>
<p style="text-align:justify;"><span style="font-family:Verdana;">Ban đầu, <span style="font-weight:bold;">Fri3ng3R </span>tính dịch các hàm và các kiểu dữ liệu thường dùng trong <span style="font-weight:bold;">WinAPI </span>để dễ tham khảo. Nhưng vì chưa có thời gian rãnh nên chỉ mới dịch được 1 phần bài &#8220;<a href="../2009/06/16/cac-kieu-du-lieu-trong-winapi/"><span style="font-weight:bold;">Các kiểu dữ liệu thường dùng trong WinAPI</span></a>&#8220;, cho nên sau này nếu rãnh sẽ dịch tiếp và dịch thêm bài &#8220;<span style="font-weight:bold;">Danh Sach Tra Cứu Các Hàm Trong WinAPI</span>&#8220;. Hôm qua, tình cờ lục lọi lại trong đóng tài liệu ebook cũ trên máy thấy lại được cuốn tra cứu này, mặc dù khá cũ, và không đầy đủ như <span style="font-weight:bold;">MSDN</span> mới nhất nhưng những hàm, hằng số, các định danh </span><span style="font-family:Verdana;">cơ bản thường dùng </span><span style="font-family:Verdana;">trong <span style="font-weight:bold;">WinAPI </span>thì có khá đầy đủ và chi tiết. <span style="font-weight:bold;color:#ff0000;">Download</span><span style="color:#ff0000;"> </span><a href="http://www.mediafire.com/?x8lx33gnujw"><span style="font-weight:bold;">tại đây</span></a>.</span></p>
<p><!--more--><span style="font-family:Verdana;font-weight:bold;">Thông tin về tài liệu:</span><br style="font-family:Verdana;" /></p>
<ul>
<li><span style="font-family:Verdana;">Định dạng: HLP</span></li>
<li><span style="font-family:Verdana;">Dung lượng: 24MB</span></li>
<li><span style="font-family:Verdana;">Mức độ sử dụng: Dễ</span></li>
<li><span style="font-family:Verdana;">Phần mềm cần thiết để sử dụng: Không</span></li>
<li><span style="font-family:Verdana;">Đánh giá: 3/5</span></li>
</ul>
<p><span style="font-family:Verdana;">Have fun.</span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Các Kiểu Dữ Liệu Trong WinAPI]]></title>
<link>http://fri3ng3r.wordpress.com/2009/06/16/cac-kieu-du-lieu-trong-winapi/</link>
<pubDate>Tue, 16 Jun 2009 02:48:09 +0000</pubDate>
<dc:creator>Fri3ng3R</dc:creator>
<guid>http://fri3ng3r.wordpress.com/2009/06/16/cac-kieu-du-lieu-trong-winapi/</guid>
<description><![CDATA[Đây là bộ tài liệu tra cứu các kiểu dữ liệu thường dùng trong WinAPI, được sưu tầm, tham khảo và dịc]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p style="text-align:justify;"><span style="font-family:Verdana;font-style:italic;">Đây là bộ tài liệu tra cứu các kiểu dữ liệu thường dùng trong WinAPI, được sưu tầm, tham khảo và dịch lại từ nhiều nguồn tài liệu</span><span style="font-family:Verdana;font-style:italic;"> khác nhau. Vì năng lực của  <strong>Fri3ng3R</strong> còn hạn chế nên bài viết này còn rất nhiều thiếu sót, mong các bạn ủng hộ, đóng góp và bổ sung thêm. Xin cảm ơn nhiều. Tham khảo thêm <strong><a href="http://fishark.pixnet.net/blog/post/8184872" target="_blank">tại đây</a></strong>.<br />
</span></p>
<p><span style="font-family:Verdana;">Danh sách được sắp xếp theo 2 kiểu nhằm giúp cho việc tra cứu 1 cách dễ dàng.</span></p>
<p><img class="aligncenter size-full wp-image-119" title="components" src="http://fri3ng3r.wordpress.com/files/2009/06/components.jpg" alt="components" width="382" height="242" /><!--more--><span style="font-family:Verdana;"><span style="font-size:medium;"><span style="font-weight:700;text-decoration:underline;">I. Sắp Xếp Theo ABC</span>:</span></span></p>
<p><span style="font-family:Verdana;">ATOM &#8211; atom (atom a string table reference)</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;"> </span><span style="font-family:Verdana;">BOOL &#8211; (INT) Kiểu logic, có giá trị là True hay False.</span><br />
<span style="font-family:Verdana;">BOOLEAN &#8211; (BYTE) Kiểu logic, có giá trị là True hay False.</span><br />
<span style="font-family:Verdana;">BSTR (OLECHAR*) Kiểu con trỏ đến chuỗi cơ bản hay chuỗi nhị phân 32-bit, kết thúc bằng 2 kí tự Null 0. Được sự dụng trong lập trình COM.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">BYTE &#8211; (unsigned char) Kiểu số nguyên không dấu 8-bit.</span><br />
<span style="font-family:Verdana;">CCHAR &#8211;  Kiểu kí tự 8-bit (Windows ANSI).</span><br />
<span style="font-family:Verdana;">CHAR  &#8211; Kiểu kí tự 8-bit (Windows ANSI).</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">DWORD &#8211; (unsigned long) Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">DWORD32 &#8211; Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">DWORD64 &#8211; Kiểu số nguyên không dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">DWORD_PTR &#8211; Kiểu số nguyên không dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ DWORD để tính toán, và là kiểu cho các tham số 32-bit có thể mở rộng thành kiểu 64-bit trong hệ điều hành Windows 64-bit.</span><br />
<span style="font-family:Verdana;">FLOAT &#8211; (float) Kiểu số thực dấu chấm động.</span><br />
<span style="font-family:Verdana;">GLOBALHANDLE &#8211; (HANDLE) Kiểu mã điều khiển toàn cục</span><br />
<span style="font-family:Verdana;">HACCEL &#8211; (HANDLE) Kiểu mã điều khiển đến bảng mô tả phím tắt Accelerator.</span><br />
<span style="font-family:Verdana;">HANDLE &#8211; (void*) Kiểu mã điều khiển của một đối tượng (một số nguyên 32-bit không dấu)</span>.<br />
<span style="font-family:Verdana;">HBITMAP &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng ảnh Bitmap.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HBRUSH &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Brush (cọ vẽ).</span><br />
<span style="font-family:Verdana;">HCONV &#8211; (HANDLE) Kiểu mã điều khiển của 1 DDE (Dynamic Data Exchange).</span><br />
<span style="font-family:Verdana;">HCONVLIST &#8211; Kiểu mã điều khiển của 1danh sách DDE.</span><br />
<span style="font-family:Verdana;">HCURSOR &#8211; (HICON) Kiểu mã điều khiển của 1 đối tượng Cursor (con trỏ chuột).</span><br />
<span style="font-family:Verdana;">HDC &#8211; (HANDLE)  Kiểu mã điều khiển của 1 Device Context (DC).</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HDDEDATA &#8211; Kiểu mã điều khiển của 1 chuỗi DDE</span><br />
<span style="font-family:Verdana;">HDESK &#8211; (HANDLE) Kiểu mã điều khiển của Desktop.</span><br />
<span style="font-family:Verdana;">HDLG &#8211; (HANDLE) Kiểu mã điều khiển của hộp thoại Dialog.</span><br />
<span style="font-family:Verdana;">HDROP &#8211; Kiểu mã điều khiển của 1 cấu trúc thả nội bộ.</span><br />
<span style="font-family:Verdana;">HDWP &#8211; Kiểu mã điều khiển của 1  vị trí của cấu trúc của cửa sổ mở rộng.</span><br />
<span style="font-family:Verdana;">HENHMETAFILE &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Metafile tăng cường.</span><br />
<span style="font-family:Verdana;">HFILE &#8211; (int hay short)  Kiểu mã điều khiển của 1 đối tượng tập tin, được mở bằng hàm OpenFile chứ không phải hàm CreateFile.<br />
</span><span style="font-family:Verdana;">HFONT &#8211; (HANDLE) Kiểu mã điều khiển của đối tượng Font.</span><br />
<span style="font-family:Verdana;">HGDIOBJ &#8211; (HANDLE (void NEAR*)) Kiểu mã điều khiển của 1 đối tượng đồ họa GDI.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HGLOBAL &#8211; (HANDLE) Kiểu mã điều khiển của 1 khối nhớ toàn cục.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HHOOK &#8211; (HANDLE) Kiểu mã điều khiển của 1 hàm Hook.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HICON &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Icon (biểu tượng).</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HIMAGELIST &#8211; Kiểu mã điều khiển của 1 đối tượng ImageList.</span><br />
<span style="font-family:Verdana;">HIMC &#8211;  Kiểu mã điều khiển của 1 bộ gõ ngôn ngữ của Windows.</span><br />
<span style="font-family:Verdana;">HINSTANCE &#8211; (HANDLE) Kiểu mã điều khiển của 1 Hinstance.</span><br />
<span style="font-family:Verdana;">HKEY &#8211; (HANDLE) Kiểu mã điều khiển của 1 khóa Registry.</span><br />
<span style="font-family:Verdana;">HKL &#8211; (HANDLE) Kiểu mã điều khiển của Input Locale.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HLOCAL &#8211; (HANDLE) Kiểu mã điều khiển của 1 khối nhớ cục bộ.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMEMU &#8211; (HANDLE) Kiểu mã điều khiển của 1đối tượng Menu.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMETAFILE &#8211; (HANDLE)  Kiểu mã điều khiển của 1đối tượng Meta-file.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMIDIIN &#8211; Kiểu mã điều khiển của 1 MIDI (Musical Instrument Digital Interface)</span>.<br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMIDIOUT &#8211; Kiểu mã điều khiển của việc xuất tập tin MIDI.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMMIO &#8211; Kiểu mã điều khiển của 1đối tượng Document.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMODULE &#8211; (HINSTANCE) Kiểu mã điều khiển của 1 Module. Lưu trữ địa chỉ bắt đầu của Module.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HMONITOR &#8211; (HANDLE) Kiểu mã điều khiển của 1 màn hình hiện thị.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HPALETTE &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Hpalette (bảng màu).</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HPEN &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Pen (bút vẽ).</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HRGN &#8211; (HANDLE) Kiểu mã điều khiển của 1 miền Domain.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HRSRC &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Resource.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HSZ &#8211; (HANDLE) Kiểu mã điều khiển của 1 chuỗi DEE.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HWAVEIN &#8211; Kiểu mã điều khiển của nhập tập tin âm thanh dạng Wav.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">HWAVEOUT &#8211; Kiểu mã điều khiển của xuất tập tin âm thanh dạng Wav.<br />
</span><span style="font-family:Verdana;">HWINSTA &#8211; (HANDLE)  Kiểu mã điều khiển của 1 trạm làm việc trong mạng nội bộ.</span><br />
<span style="font-family:Verdana;">HWND &#8211; (HANDLE) Kiểu mã điều khiển của 1 cửa sổ (một số nguyên 32-bit không dấu).</span><br />
<span style="font-family:Verdana;">INT &#8211; (int) Kiểu số nguyên có dấu 32-bit.</span><br />
<span style="font-family:Verdana;">INT32 &#8211; Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">INT64 &#8211; Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">INT_PTR &#8211; Kiểu số nguyên có dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ INT để tính toán.</span><br />
<span style="font-family:Verdana;">LOCALHANDLE &#8211; (HANDLE) Kiểu mã điều khiển cục bộ.</span><br />
<span style="font-family:Verdana;">LONG &#8211; (long) Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LONG32 &#8211; Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LONG64 &#8211; Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LONGLONG &#8211; (__int64 hay double) Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LONG_PTR  &#8211; Kiểu số nguyên có dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ LONG để tính toán.</span><br />
<span style="font-family:Verdana;">LPBYTE &#8211; (BYTE far*) Kiểu con trỏ đến số kiểu BYTE.</span><br />
<span style="font-family:Verdana;">LPBOOL &#8211; (BOOL far*) Kiểu con trỏ đến kiểu BOOL.</span><br />
<span style="font-family:Verdana;">LPCOLESTR (const OLECHAR*) Kiểu con trỏ hằng đến OLECHAR.</span><br />
<span style="font-family:Verdana;">LPCSTR &#8211; (CONST CHAR *) Kiểu con trỏ đến 1chuỗi kí tự hằng, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPCTSTR &#8211; (LPCWSTR hay LPCSTR) Nếu Unicode được định nghĩa, kiểu con trỏ hằng này tương đương với LPCWSTR; ngược lại sẽ tương đương với LPCSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPCWCH &#8211; (CONST WCHAR FAR*) Kiểu con trỏ long đến 1chuỗi kí tự hằng WCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPCWSTR &#8211; (CONST WCHAR FAR*) Kiểu con trỏ long đến 1chuỗi kí tự hằng WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPDWORD &#8211; (DWORD far*) Kiểu con trỏ đến số kiểu DWORD.</span><br />
<span style="font-family:Verdana;">LPINT &#8211; (INT far*) Kiểu con trỏ đến số kiểu INT.</span><br />
<span style="font-family:Verdana;">LPLONG &#8211; (LONG far*) Kiểu con trỏ đến số kiểu LONG.</span><br />
<span style="font-family:Verdana;">LPOLESTR &#8211; (OLECHAR*) Kiểu con trỏ đến OLECHAR.</span><br />
<span style="font-family:Verdana;">LPHANDLE &#8211; (HANDLE FAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br />
<span style="font-family:Verdana;">LPHWAVEIN &#8211; Kiểu con trỏ đến kiểu HWAVEIN.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPHWAVEOUT &#8211; Kiểu con trỏ đến kiểu HWAVEOUT.</span><br />
<span style="font-family:Verdana;">LPSTR &#8211; (CHAR *) Kiểu con trỏ long đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPTCH &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPTSTR &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">LPWORD &#8211; (WORD far*) Kiểu con trỏ đến số kiểu WORD.</span><br />
<span style="font-family:Verdana;">LPWSTR &#8211; (WCHAR FAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">NPSTR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">NWPSTR &#8211; (WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">OLECHAR (wchar_t) Kiểu kí tự UNICODE 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PBYTE &#8211; (BYTE near*) Kiểu con trỏ đến số kiểu BYTE.</span><br />
<span style="font-family:Verdana;">PBOOL &#8211; (BOOL near*) Kiểu con trỏ đến kiểu BOOL.</span><br />
<span style="font-family:Verdana;">PBOOLEAN &#8211; (BOOLEAN*) Kiểu con trỏ đến kiểu BOOLEAN.</span><br />
<span style="font-family:Verdana;">PCHAR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự. </span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PCSTR &#8211; (CONST CHAR *) Kiểu con trỏ đến 1chuỗi kí tự hằng, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PCTSTR &#8211; (PCWSTR hay PCSTR) Nếu Unicode được định nghĩa, kiểu con trỏ hằng này tương đương với PCWSTR; ngược lại sẽ tương đương với PCSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PCWCH &#8211; (CONST WCHAR*)  Kiểu con trỏ đến 1chuỗi kí tự hằng WCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PCWSTR &#8211; (CONST WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự hằng WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PDWORD &#8211; (DWORD near*) Kiểu con trỏ đến số kiểu DWORD.</span><br />
<span style="font-family:Verdana;">PFLOAT &#8211; (FLOAT near*) Kiểu con trỏ đến kiểu FLOAT.</span><br />
<span style="font-family:Verdana;">PHANDLE &#8211; (HANDLE NEAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br />
<span style="font-family:Verdana;">PINT &#8211; (INT near*) Kiểu con trỏ đến số kiểu INT.</span><br />
<span style="font-family:Verdana;">PLONG &#8211; (LONG near*) Kiểu con trỏ đến số kiểu LONG.</span><br />
<span style="font-family:Verdana;">PLONGLONG &#8211; (LONGLONG*) Kiểu con trỏ đến số kiểu LONGLONG.</span><br />
<span style="font-family:Verdana;">PSHORT &#8211; (SHORT*) Kiểu con trỏ đến số kiểu SHORT.</span><br />
<span style="font-family:Verdana;">PSTR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.<br />
PSZ &#8211; (char *) Kiểu con trỏ đến 1 chuỗi kí tự, kết thúc bằng 0. </span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PTBYTE &#8211; (WCHAR * hay unsigned char *) Kiểu con trỏ đến số kiểu TBYTE.</span><br />
<span style="font-family:Verdana;">PTCH &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PTCHAR &#8211; (WCHAR* hay CHAR *) Kiểu con trỏ đến 1 chuỗi kí tự TCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PTSTR &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PUCHAR &#8211; (UCHAR*) Kiểu con trỏ đến chuỗi kí tự UCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PUINT &#8211; (UINT*) Kiểu con trỏ đến số kiểu UINT.</span><br />
<span style="font-family:Verdana;">PULONG &#8211; (ULONG*) Kiểu con trỏ đến số kiểu ULONG.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PULONGLONG &#8211; (ULONGLONG*) Kiểu con trỏ đến số kiểu ULONGLONG.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PUSHORT &#8211; (USHORT*) Kiểu con trỏ đến số kiểu USHORT.</span><br />
<span style="font-family:Verdana;">PWCH &#8211; (WCHAR*) Kiểu con trỏ đến WCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PWCHAR &#8211; (WCHAR*) Kiểu con trỏ đến WCHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PWSTR &#8211; (WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">PWORD &#8211; (WORD near*) Kiểu con trỏ đến số kiểu WORD.</span><br />
<span style="font-family:Verdana;">SC_HANDLE &#8211; Kiểu mã điều khiển của 1 dịch vụ quản lí cơ sở dữ liệu.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">SC_LOCK &#8211; Kiểu mã điều khiển của ràng buộc dịch vụ quản lí cơ sở dữ liệu</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">SERVICE_STATUS_HANDLE &#8211; Kiểu mã điều khiển của 1 trạng thái dịch vụ.</span><br />
<span style="font-family:Verdana;">SHORT &#8211; (short) Kiểu số nguyên ngắn 16-bit (có dấu).</span><br />
<span style="font-family:Verdana;">SPHANDLE &#8211; (HANDLE NEAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br />
<span style="font-family:Verdana;">TBYTE &#8211; (WCHAR hay unsigned char) Nếu Unicode được định nghĩa, kiểu này tương đương với WCHAR; ngược lại tương đương với CHAR không dấu.</span><br />
<span style="font-family:Verdana;">TCHAR &#8211; Nếu cờ hiệu UNICODE được định nghĩa, kiểu này tương đương với WCHAR; ngược lại sẽ tương đương với CHAR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">UCHAR &#8211; (unsigned char) Kiểu kí tự không dấu.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">UINT &#8211; (unsigned int) Kiểu số nguyên INT không dấu.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">UINT32 &#8211; Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">UINT64 &#8211; Kiểu số nguyên không dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">UINT_PTR &#8211; Kiểu số nguyên không dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ UINT để tính toán.</span><br />
<span style="font-family:Verdana;">ULONG &#8211; (unsigned long) Kiểu số nguyên LONG không dấu.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">ULONG32 &#8211; Kiểu số nguyên LONG không dấu 32-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">ULONG64 &#8211; Kiểu số nguyên LONG không dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">ULONGLONG &#8211; (unsigned __int64 hay double) Kiểu số nguyên có không dấu 64-bit.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">ULONG_PTR &#8211; Kiểu con trỏ đến số nguyên không dấu của LONG_PTR.</span><br style="font-family:Verdana;" /> <span style="font-family:Verdana;">USHORT &#8211; (unsigned short) Kiểu số nguyên ngắn (không dấu).</span><br />
<span style="font-family:Verdana;">WCHAR &#8211; (wchar_t) Kiểu kí tự Unicode 16-bit.<br />
</span><span style="font-family:Verdana;">WORD &#8211; (unsigned short)  Kiểu số nguyên ngắn không dấu 16 bit.</span></p>
<p style="text-align:center;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p><span style="font-family:Verdana;"><span style="font-size:medium;"><span style="font-weight:700;text-decoration:underline;">II. Sắp Xếp Theo Từng Kiểu</span><span style="font-family:Verdana;">:</span></span></span><span style="font-family:Verdana;"> </span><span style="font-weight:bold;"><span style="text-decoration:underline;"> </span></span></p>
<p style="text-align:justify;"><span style="font-weight:bold;font-family:Verdana;"><span style="text-decoration:underline;">1. Kiểu Kí Tự</span>:<br />
</span><span style="font-family:Verdana;">CHAR  &#8211; Kiểu kí tự 8-bit (Windows ANSI).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">CCHAR &#8211;  Kiểu kí tự 8-bit (Windows ANSI).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PSZ &#8211; (char *) Kiểu con trỏ đến 1 chuỗi kí tự, kết thúc bằng 0. </span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PCHAR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự. </span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PSTR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPSTR &#8211; (CHAR *) Kiểu con trỏ long đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">NPSTR &#8211; (CHAR *) Kiểu con trỏ đến 1chuỗi kí tự, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PCSTR &#8211; (CONST CHAR *) Kiểu con trỏ đến 1chuỗi kí tự hằng, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPCSTR &#8211; (CONST CHAR *) Kiểu con trỏ đến 1chuỗi kí tự hằng, kết thúc bằng 0. Đây là chuỗi dạng ANSI 8 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">WCHAR &#8211; (wchar_t) Kiểu kí tự Unicode 16-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PWCH &#8211; (WCHAR*) Kiểu con trỏ đến WCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PWCHAR &#8211; (WCHAR*) Kiểu con trỏ đến WCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PWSTR &#8211; (WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPWSTR &#8211; (WCHAR FAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">NWPSTR &#8211; (WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PCWCH &#8211; (CONST WCHAR*)  Kiểu con trỏ đến 1chuỗi kí tự hằng WCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPCWCH &#8211; (CONST WCHAR FAR*) Kiểu con trỏ long đến 1chuỗi kí tự hằng WCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PCWSTR &#8211; (CONST WCHAR*) Kiểu con trỏ đến 1chuỗi kí tự hằng WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPCWSTR &#8211; (CONST WCHAR FAR*) Kiểu con trỏ long đến 1chuỗi kí tự hằng WCHAR, kết thúc bằng 0. Đây là chuỗi dạng Unicode 16 bit/kí tự.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">TCHAR &#8211; Nếu cờ hiệu UNICODE được định nghĩa, kiểu này tương đương với WCHAR; ngược lại sẽ tương đương với CHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PTCHAR &#8211; (WCHAR* hay CHAR *) Kiểu con trỏ đến 1 chuỗi kí tự TCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PTCH &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPTCH &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PTSTR &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPTSTR &#8211; (LPWSTR hay LPSTR) Nếu Unicode được định nghĩa, kiểu con trỏ này tương đương với LPWSTR; ngược lại sẽ tương đương với LPSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PCTSTR &#8211; (PCWSTR hay PCSTR) Nếu Unicode được định nghĩa, kiểu con trỏ hằng này tương đương với PCWSTR; ngược lại sẽ tương đương với PCSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPCTSTR &#8211; (LPCWSTR hay LPCSTR) Nếu Unicode được định nghĩa, kiểu con trỏ hằng này tương đương với LPCWSTR; ngược lại sẽ tương đương với LPCSTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">UCHAR &#8211; (unsigned char) Kiểu kí tự không dấu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PUCHAR &#8211; (UCHAR*) Kiểu con trỏ đến chuỗi kí tự UCHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">BSTR (OLECHAR*) Kiểu con trỏ đến chuỗi cơ bản hay chuỗi nhị phân 32-bit, kết thúc bằng 2 kí tự Null 0. Được sự dụng trong lập trình COM.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">OLECHAR (wchar_t) Kiểu kí tự UNICODE 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPOLESTR (OLECHAR*) Kiểu con trỏ đến OLECHAR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPCOLESTR (const OLECHAR*) Kiểu con trỏ hằng đến OLECHAR.</span></p>
<p style="text-align:center;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="text-align:justify;"><span style="font-weight:bold;font-family:Verdana;"><span style="text-decoration:underline;">2. Kiểu Số</span>:</span><br />
<span style="font-family:Verdana;">BYTE &#8211; (unsigned char) Kiểu số nguyên không dấu 8-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PBYTE &#8211; (BYTE near*) Kiểu con trỏ đến số kiểu BYTE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPBYTE &#8211; (BYTE far*) Kiểu con trỏ đến số kiểu BYTE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">TBYTE &#8211; (WCHAR hay unsigned char) Nếu Unicode được định nghĩa, kiểu này tương đương với WCHAR; ngược lại tương đương với CHAR không dấu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PTBYTE &#8211; (WCHAR * hay unsigned char *) Kiểu con trỏ đến số kiểu TBYTE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">BOOL &#8211; (INT) Kiểu logic, có giá trị là True hay False.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PBOOL &#8211; (BOOL near*) Kiểu con trỏ đến kiểu BOOL.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPBOOL &#8211; (BOOL far*) Kiểu con trỏ đến kiểu BOOL.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">BOOLEAN &#8211; (BYTE) Kiểu logic, có giá trị là True hay False.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PBOOLEAN &#8211; (BOOLEAN*) Kiểu con trỏ đến kiểu BOOLEAN.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">SHORT &#8211; (short) Kiểu số nguyên ngắn 16-bit (có dấu).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PSHORT &#8211; (SHORT*) Kiểu con trỏ đến số kiểu SHORT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">USHORT &#8211; (unsigned short) Kiểu số nguyên ngắn (không dấu).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PUSHORT &#8211; (USHORT*) Kiểu con trỏ đến số kiểu USHORT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">INT &#8211; (int) Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">INT32 &#8211; Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">INT64 &#8211; Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">INT_PTR &#8211; Kiểu số nguyên có dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ INT để tính toán.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PINT &#8211; (INT near*) Kiểu con trỏ đến số kiểu INT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPINT &#8211; (INT far*) Kiểu con trỏ đến số kiểu INT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">UINT &#8211; (unsigned int) Kiểu số nguyên INT không dấu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">UINT32 &#8211; Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">UINT64 &#8211; Kiểu số nguyên không dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">UINT_PTR &#8211; Kiểu số nguyên không dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ UINT để tính toán.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PUINT &#8211; (UINT*) Kiểu con trỏ đến số kiểu UINT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LONG &#8211; (long) Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LONG32 &#8211; Kiểu số nguyên có dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LONG64 &#8211; Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LONGLONG &#8211; (__int64 hay double) Kiểu số nguyên có dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LONG_PTR  &#8211; Kiểu số nguyên có dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ LONG để tính toán.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PLONG &#8211; (LONG near*) Kiểu con trỏ đến số kiểu LONG.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPLONG &#8211; (LONG far*) Kiểu con trỏ đến số kiểu LONG.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PLONGLONG &#8211; (LONGLONG*) Kiểu con trỏ đến số kiểu LONGLONG.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">ULONG &#8211; (unsigned long) Kiểu số nguyên LONG không dấu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">ULONG32 &#8211; Kiểu số nguyên LONG không dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">ULONG64 &#8211; Kiểu số nguyên LONG không dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">ULONGLONG &#8211; (unsigned __int64 hay double) Kiểu số nguyên có không dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">ULONG_PTR &#8211; Kiểu con trỏ đến số nguyên không dấu của LONG_PTR.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PULONG &#8211; (ULONG*) Kiểu con trỏ đến số kiểu ULONG.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PULONGLONG &#8211; (ULONGLONG*) Kiểu con trỏ đến số kiểu ULONGLONG.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">WORD &#8211; (unsigned short)  Kiểu số nguyên ngắn không dấu 16 bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PWORD &#8211; (WORD near*) Kiểu con trỏ đến số kiểu WORD.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPWORD &#8211; (WORD far*) Kiểu con trỏ đến số kiểu WORD.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">DWORD &#8211; (unsigned long) Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">DWORD32 &#8211; Kiểu số nguyên không dấu 32-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">DWORD64 &#8211; Kiểu số nguyên không dấu 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">DWORD_PTR &#8211; Kiểu số nguyên không dấu 32-bit. Sử dụng khi cần chuyển kiểu con trỏ DWORD để tính toán, và là kiểu cho các tham số 32-bit có thể mở rộng thành kiểu 64-bit trong hệ điều hành Windows 64-bit.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PDWORD &#8211; (DWORD near*) Kiểu con trỏ đến số kiểu DWORD.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPDWORD &#8211; (DWORD far*) Kiểu con trỏ đến số kiểu DWORD.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">FLOAT &#8211; (float) Kiểu số thực dấu chấm động.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PFLOAT &#8211; (FLOAT near*) Kiểu con trỏ đến kiểu FLOAT.</span></p>
<p style="text-align:center;">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;</p>
<p style="text-align:justify;"><span style="font-weight:bold;font-family:Verdana;"><span style="text-decoration:underline;">3. Kiểu Mã Điều Khiển</span>:</span><br />
<span style="font-family:Verdana;">HANDLE &#8211; (void*) Kiểu mã điều khiển của một đối tượng (một số nguyên 32-bit không dấu)</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">PHANDLE &#8211; (HANDLE NEAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">SPHANDLE &#8211; (HANDLE NEAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPHANDLE &#8211; (HANDLE FAR*) Kiểu con trỏ đến kiểu HANDLE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">GLOBALHANDLE &#8211; (HANDLE) Kiểu mã điều khiển toàn cục</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDC &#8211; (HANDLE)  Kiểu mã điều khiển của 1 Device Context (DC).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HBITMAP &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng ảnh Bitmap.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HBRUSH &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Brush (cọ vẽ).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HICON &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Icon (biểu tượng).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HCURSOR &#8211; (HICON) Kiểu mã điều khiển của 1 đối tượng Cursor (con trỏ chuột).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HPALETTE &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Hpalette (bảng màu).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HPEN &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Pen (bút vẽ).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HCONV &#8211; (HANDLE) Kiểu mã điều khiển của 1 DDE (Dynamic Data Exchange).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HACCEL &#8211; (HANDLE) Kiểu mã điều khiển đến bảng mô tả phím tắt Accelerator.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HCONVLIST &#8211; Kiểu mã điều khiển của 1danh sách DDE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDDEDATA &#8211; Kiểu mã điều khiển của 1 chuỗi DDE</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDESK &#8211; (HANDLE) Kiểu mã điều khiển của Desktop.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDLG &#8211; (HANDLE) Kiểu mã điều khiển của hộp thoại Dialog.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDROP &#8211; Kiểu mã điều khiển của 1 cấu trúc thả nội bộ.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HDWP &#8211; Kiểu mã điều khiển của 1  vị trí của cấu trúc của cửa sổ mở rộng.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HENHMETAFILE &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Metafile tăng cường.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HFILE &#8211; (int hay short)  Kiểu mã điều khiển của 1 đối tượng tập tin, được mở bằng hàm OpenFile chứ không phải hàm CreateFile.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HFONT &#8211; (HANDLE) Kiểu mã điều khiển của đối tượng Font.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HGDIOBJ &#8211; (HANDLE (void NEAR*)) Kiểu mã điều khiển của 1 đối tượng đồ họa GDI.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HGLOBAL &#8211; (HANDLE) Kiểu mã điều khiển của 1 khối nhớ toàn cục.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HHOOK &#8211; (HANDLE) Kiểu mã điều khiển của 1 hàm Hook.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HIMAGELIST &#8211; Kiểu mã điều khiển của 1 đối tượng ImageList.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HIMC &#8211;  Kiểu mã điều khiển của 1 bộ gõ ngôn ngữ của Windows.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HINSTANCE &#8211; (HANDLE) Kiểu mã điều khiển của 1 Hinstance.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HKEY &#8211; (HANDLE) Kiểu mã điều khiển của 1 khóa Registry.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HKL &#8211; (HANDLE) Kiểu mã điều khiển của Input Locale.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HLOCAL &#8211; (HANDLE) Kiểu mã điều khiển của 1 khối nhớ cục bộ.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMEMU &#8211; (HANDLE) Kiểu mã điều khiển của 1đối tượng Menu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMETAFILE &#8211; (HANDLE)  Kiểu mã điều khiển của 1đối tượng Meta-file.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMIDIIN &#8211; Kiểu mã điều khiển của 1 MIDI (Musical Instrument Digital Interface)</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMIDIOUT &#8211; Kiểu mã điều khiển của việc xuất tập tin MIDI.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMMIO &#8211; Kiểu mã điều khiển của 1đối tượng Document.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMODULE &#8211; (HINSTANCE) Kiểu mã điều khiển của 1 Module. Lưu trữ địa chỉ bắt đầu của Module.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HMONITOR &#8211; (HANDLE) Kiểu mã điều khiển của 1 màn hình hiện thị.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HRGN &#8211; (HANDLE) Kiểu mã điều khiển của 1 miền Domain.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HRSRC &#8211; (HANDLE) Kiểu mã điều khiển của 1 đối tượng Resource.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HSZ &#8211; (HANDLE) Kiểu mã điều khiển của 1 chuỗi DEE.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HWAVEIN &#8211; Kiểu mã điều khiển của nhập tập tin âm thanh dạng Wav.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HWAVEOUT &#8211; Kiểu mã điều khiển của xuất tập tin âm thanh dạng Wav.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPHWAVEIN &#8211; Kiểu con trỏ đến kiểu HWAVEIN.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LPHWAVEOUT &#8211; Kiểu con trỏ đến kiểu HWAVEOUT.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HWINSTA &#8211; (HANDLE)  Kiểu mã điều khiển của 1 trạm làm việc trong mạng nội bộ.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">HWND &#8211; (HANDLE) Kiểu mã điều khiển của 1 cửa sổ (một số nguyên 32-bit không dấu).</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">LOCALHANDLE &#8211; (HANDLE) Kiểu mã điều khiển cục bộ.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">SC_HANDLE &#8211; Kiểu mã điều khiển của 1 dịch vụ quản lí cơ sở dữ liệu.</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">SC_LOCK &#8211; Kiểu mã điều khiển của ràng buộc dịch vụ quản lí cơ sở dữ liệu</span><br style="font-family:Verdana;" /><span style="font-family:Verdana;">SERVICE_STATUS_HANDLE &#8211; Kiểu mã điều khiển của 1 trạng thái dịch vụ.</span></p>
<p><span style="font-size:small;"><strong>~Fri3ng3R~</strong></span><span style="font-size:medium;"><strong></strong></span></p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Überprüfen ob die Freigabe existiert]]></title>
<link>http://grauberger.wordpress.com/2009/05/30/uberprufen-ob-die-freigabe-existiert/</link>
<pubDate>Sat, 30 May 2009 23:29:06 +0000</pubDate>
<dc:creator>grauberger</dc:creator>
<guid>http://grauberger.wordpress.com/2009/05/30/uberprufen-ob-die-freigabe-existiert/</guid>
<description><![CDATA[Um zu überprüfen ob eine Freigabe existiert, könnte ich jetzt auch schreiben, ihr findet alles in de]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Um zu überprüfen ob eine Freigabe existiert, könnte ich jetzt auch schreiben, ihr findet alles in der msdn. Aber da ich selber solche Antworten in Foren etc. hasse, möchte ich meine Funktion dafür veröffentlichen.</p>
<pre><span style="color:#0000ff;">bool </span>isShareExist(<span style="color:#0000ff;">const</span> <span style="color:#0000ff;">QString</span> &#38;shareName)
{
   <span style="color:#0000ff;">wchar_t</span> zShareName[MAX_PATH];
  
   QStringToWCHAR_T(shareName, zShareName);
   SHARE_INFO_0 pInfo;
   NET_API_STATUS status = NetShareGetInfo(
                                                               <span style="color:#0000ff;">NULL</span>,
                                                               <span style="color:#0000ff;">reinterpret_cast</span>&#60;LPSTR&#62;(zShareName),
                                                               0,
                                                               <span style="color:#0000ff;">reinterpret_cast</span>&#60;LPBYTE*&#62;(&#38;pInfo));
   <span style="color:#0000ff;">bool</span> ok = <span style="color:#0000ff;">false</span>;
   <span style="color:#0000ff;">switch</span>(status)
   {
      <span style="color:#0000ff;">case</span> NERR_Success:
         ok = <span style="color:#0000ff;">true</span>;
         <span style="color:#0000ff;">break</span>;
      <span style="color:#0000ff;">case</span> ERROR_ACCESS_DENIED:
         <span style="color:#0000ff;">QMessageBox</span>::critical(0, <span style="color:#ff0000;">"Fehler"</span>, <span style="color:#ff0000;">"Sie verfügen nicht über die Berechtigung, Informationen über Freigaben auszulesen."</span>);
       <span style="color:#0000ff;">  break<span style="color:#000000;">;
</span></span>      <span style="color:#0000ff;">case</span> ERROR_INVALID_PARAMETER:
         <span style="color:#0000ff;">QMessageBox</span>::critical(0, <span style="color:#ff0000;">"Fehler"</span>, <span style="color:#ff0000;">"Fehler im Systemaufruf: Ungültiger Parameter beim Auslesen von Informationen über Freigaben."</span>);
         <span style="color:#0000ff;">break<span style="color:#000000;">;
</span></span>      <span style="color:#0000ff;">case</span> ERROR_NOT_ENOUGH_MEMORY:
         <span style="color:#0000ff;">QMessageBox</span>::critical(0, <span style="color:#ff0000;">"Fehler"</span>, <span style="color:#ff0000;">"Nicht genügend verfügbarer Speicher um die Information auszulesen."</span>);
         <span style="color:#0000ff;">break<span style="color:#000000;">;</span></span>
      <span style="color:#0000ff;">case</span> ERROR_MORE_DATA:
         ok = <span style="color:#0000ff;">true</span>;
         <span style="color:#0000ff;">break</span>;
      <span style="color:#0000ff;">case</span> NERR_BufTooSmall:
         <span style="color:#0000ff;">QMessageBox</span>::critical(0, <span style="color:#ff0000;">"Fehler"</span>, <span style="color:#ff0000;">"Der übergebene Puffer ist für die benötigte Information zur klein."</span>)
         <span style="color:#0000ff;">break</span>;
      <span style="color:#0000ff;">default</span>:
         ok = <span style="color:#0000ff;">false</span>;
         <span style="color:#0000ff;">break</span>;
   }
   <span style="color:#0000ff;">return</span> ok;
}</pre>
<p>Gruß</p>
<p>Rudolf Grauberger</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Überprüfen ob ein Dienst installiert/vorhanden ist]]></title>
<link>http://grauberger.wordpress.com/2009/05/30/uberprufen-ob-ein-dienst-installiertvorhanden-ist/</link>
<pubDate>Sat, 30 May 2009 23:02:38 +0000</pubDate>
<dc:creator>grauberger</dc:creator>
<guid>http://grauberger.wordpress.com/2009/05/30/uberprufen-ob-ein-dienst-installiertvorhanden-ist/</guid>
<description><![CDATA[Für ein Projekt musste ich überprüfen ob ein Dienst installiert ist, da mit der Win API gewöhnungsbe]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Für ein Projekt musste ich überprüfen ob ein Dienst installiert ist, da mit der Win API gewöhnungsbedürftig ist umzugehen, stelle ich diese Funktion allen zur Verfügung.</p>
<p><span style="color:#0000ff;"><strong>bool </strong></span>isInstalled(<strong><span style="color:#0000ff;">const</span> </strong><span style="color:#0000ff;">QString</span> &#38;serviceName, const QString &#38;serviceDisplayName)<br />
{<br />
   SC_HANDLE schSCManager = OpenSCManagerA(<br />
                                                                    <span style="color:#0000ff;"><strong>NULL</strong></span>,<br />
                                                                    <span style="color:#0000ff;"><strong>NULL</strong></span>,<br />
                                                                   SC_MANAGER_CONNECT);</p>
<p>   <strong><span style="color:#0000ff;">if</span></strong> (schSCManager == <span style="color:#0000ff;"><strong>NULL</strong></span>)<br />
   {<br />
      return false;<br />
   }</p>
<p>   std::string zServiceName = serviceName;<br />
  <br />
   const int bufferSize = 4096;<br />
   unsigned long buffer = bufferSize;<br />
   char displayName[serviceDisplayName.lengt()];<br />
  <br />
   strcpy(displayName, serviceDisplayName.toLocal8Bit().data());<br />
  <br />
  <br />
   BOOL bSuccess = GetServiceDisplayName(<br />
                                          schSCManager,<br />
                                          zServiceName.c_str(),<br />
                                          displayName,<br />
                                          &#38;buffer);</p>
<p>   <strong><span style="color:#0000ff;">return</span> </strong>bSuccess;<br />
}</p>
<p>Diese Funktinalität ist ggf. dem einen oder anderen nützlich.</p>
<p>Viel Spaß mit dieser Funktion</p>
<p>Gruß</p>
<p>Rudolf Grauberger</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Adventures In Game Development]]></title>
<link>http://ballpointgames.wordpress.com/2009/05/21/adventures-in-game-development/</link>
<pubDate>Thu, 21 May 2009 09:58:17 +0000</pubDate>
<dc:creator>ballpointgames</dc:creator>
<guid>http://ballpointgames.wordpress.com/2009/05/21/adventures-in-game-development/</guid>
<description><![CDATA[Initially I practiced game development with QBasic 1.0 on an 8086 and an 80286.  I ascended to Turbo]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Initially I practiced game development with QBasic 1.0 on an 8086 and an 80286.  I ascended to Turbo Pascal 6 on a 486.  This was using the borland graphics interface(BGI) library.  You can usually spot this library in play by the presence of a file named &#8220;egavga.bgi&#8221;.</p>
<p>I utilized some shareware or freeware &#8216;basic&#8217; compiler to put some of those QBasic games into a standalone executable form(.exe file).</p>
<p>Next up, from the internet I obtained DJGPP c++ along with ALLEGRO library and installed it on a dos-based 486-dx2 66mhz, and performed some sprite editing with a dos image editor.  Everything up to this point was dos-based game development.</p>
<p>Feeling the  lure of the intenet I tried making a game applet in Java but applets suck.  I had with me an academic version of Visual c++ 6 on CD but I lost it so I basically had to make do with &#8220;alternative freeware c++ stuff&#8221; until Visual Studio Express was released.  Thus I spent a long time using Borland c++ 5.5 command line tools as I introduced myself to WINAPI.</p>
<p>As I started learning about OpenGL I made a 3D Pong-clone, and a simple polygon car travelling around a simple polygonal terrain.</p>
<p>Of all this, much of it ended up lost as hard disks began to fail.</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Splash Screen... w C++/WinAPI]]></title>
<link>http://rollnick.wordpress.com/2009/04/15/splash-screen-w-cwinapi/</link>
<pubDate>Wed, 15 Apr 2009 09:04:11 +0000</pubDate>
<dc:creator>Karol Grzybowski</dc:creator>
<guid>http://rollnick.wordpress.com/2009/04/15/splash-screen-w-cwinapi/</guid>
<description><![CDATA[Cóż to ten Splash Screen? To nic innego, jak ekran powitalny programu. Najczęściej pojawia się przy ]]></description>
<content:encoded><![CDATA[Cóż to ten Splash Screen? To nic innego, jak ekran powitalny programu. Najczęściej pojawia się przy ]]></content:encoded>
</item>
<item>
<title><![CDATA[[C++] Creating a Window from a DLL]]></title>
<link>http://sim0n.wordpress.com/2009/03/29/c-creating-a-window-from-a-dll/</link>
<pubDate>Sun, 29 Mar 2009 11:19:04 +0000</pubDate>
<dc:creator>sim0n</dc:creator>
<guid>http://sim0n.wordpress.com/2009/03/29/c-creating-a-window-from-a-dll/</guid>
<description><![CDATA[Currently I&#8217;ve been working on a project that requires me to inject a DLL to an external progr]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Currently I&#8217;ve been working on a project that requires me to inject a DLL to an external program, and create a window under that process.<br />
Looking on the web, there are really very few resources explaining how to do this.</p>
<p>I don&#8217;t know if this is the &#8216;correct&#8217; way to do this, but it works.<br />
The basic idea behind it:</p>
<ul>
<li>On inject
<ul>
<li> Create new thread</li>
</ul>
</li>
<li>On new thread
<ul>
<li>Register window class</li>
<li>CreateWindowEx + ShowWindow</li>
<li>GetMessage and send them to a WndProc</li>
</ul>
</li>
</ul>
<p>Right so, starting off.<br />
Create a new Windows DLL and add windows.h as an include<br />
Now on the DLLMain, the entrypoint for the DLL, you want to add the code to create a new thread:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">BOOL APIENTRY DllMain( HMODULE hModule, DWORD  ul_reason_for_call,LPVOID lpReserved)
{
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(ul_reason_for_call==DLL_PROCESS_ATTACH) {
		inj_hModule = hModule;
		CreateThread(0, NULL, ThreadProc, (LPVOID)L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Title</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">NULL, NULL);
	}
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">TRUE;
}</span></pre>
</div>
<p>Im passing our new windows title as the lParam for the tread, this is not necessary &#8211; and in this situation, silly.<br />
Now we have a new thread, which has its start routine at <em>ThreadProc</em><br />
You will also need to create a new variable where we can store our modules handle:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">HINSTANCE  inj_hModule;          </span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Injected Modules Handle</span></pre>
</div>
<p>So now, lets set up our window.<br />
We are going to create a function to register our window:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">BOOL RegisterDLLWindowClass(</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">szClassName[])
{
    WNDCLASSEX wc;
    wc.hInstance =  inj_hModule;
    wc.lpszClassName = (LPCWSTR)szClassName;
    wc.lpfnWndProc = DLLWindowProc;
    wc.style = CS_DBLCLKS;
    wc.cbSize = </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">sizeof </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(WNDCLASSEX);
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.lpszMenuName = NULL;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(!RegisterClassEx (&#38;wc))
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">0;
}</span></pre>
</div>
<p>This function will register whatever class name is passed to it, again, in this situation it is unnecessary, you could just write:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">wc.lpszClassName = (LPCWSTR)L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">";</span></pre>
</div>
<p>Now, we are going to make a function to create a menu for our window, to check that the messages are being received<br />
Firstly, define two IDs for our menu</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#define </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_EXIT         (WM_APP + 101)
</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#define </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_MESSAGEBOX   (WM_APP + 102)</span></pre>
</div>
<p>Now the code for creating menus is fairly simple, we will just create 2 basic popup menus with two test buttons on, one to close the window, and one to display a messagebox.</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">HMENU CreateDLLWindowMenu()
{
	HMENU hMenu;
	hMenu = CreateMenu();
	HMENU hMenuPopup;
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(hMenu==NULL)
        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">   return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">FALSE;
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">hMenuPopup = CreatePopupMenu();
	AppendMenu (hMenuPopup, MF_STRING, MYMENU_EXIT, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">Exit</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">"));</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">AppendMenu (hMenu, MF_POPUP, (UINT_PTR) hMenuPopup, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">File</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">

	hMenuPopup = CreatePopupMenu();
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">AppendMenu (hMenuPopup, MF_STRING,MYMENU_MESSAGEBOX, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">MessageBox</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">AppendMenu (hMenu, MF_POPUP, (UINT_PTR) hMenuPopup, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">Test</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">hMenu;
}</span></pre>
</div>
<p>That returns a handle to our new menu, which we can pass to the CreateWindowEx function.<br />
So, now lets deal with out ThreadProc, the start routine for the thread.<br />
To begin with, I cast the lParam from a LPVOID &#8211; which contains our window name &#8211; back to a wchar_t<br />
I then use the CreateDLLWindowMenu function and RegisterDLLWindowClass to be used in CreateWindowEx<br />
Then just create the window, show it and handle the messages:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">DWORD WINAPI ThreadProc( LPVOID lpParam )
{
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MSG messages;
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">*pString = </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">reinterpret_cast</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">&#60;</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">* &#62; (lpParam);
	HMENU hMenu = CreateDLLWindowMenu();
	RegisterDLLWindowClass(L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">");</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	prnt_hWnd = FindWindow(L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Injected Into ClassName</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Injected Into Caption</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">");</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	HWND hwnd = CreateWindowEx (0, L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">pString, WS_EX_PALETTEWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, prnt_hWnd, hMenu,inj_hModule, NULL );
	ShowWindow (hwnd, SW_SHOWNORMAL);
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">while </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(GetMessage (&#38;messages, NULL, 0, 0))
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">{
		TranslateMessage(&#38;messages);
        </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">DispatchMessage(&#38;messages);
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">}
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">1;
}</span></pre>
</div>
<p>Since I wanted this window to have a parent, I used FindWindow to locate the handle, and passed that to the CreateWindowEx, you would need to add another HWND to your globals:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">HWND       prnt_hWnd;            </span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Parent Window Handle</span></pre>
</div>
<p>Now we need to set up our WndProc for the new window, this is stated in the RegisterDLLWindowClass:</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">wc.lpfnWndProc = DLLWindowProc;</span></pre>
</div>
<p>So we create the WndProc and handle the messages that we will receive from the Menu (Exit and MessageBox)</p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">LRESULT CALLBACK DLLWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">switch </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(message)
    {
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">WM_COMMAND:
               </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">switch</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(wParam)
               {
                    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_EXIT:
						SendMessage(hwnd, WM_CLOSE, 0, 0);
                        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
                    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_MESSAGEBOX:
						MessageBox(hwnd, L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Test</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"MessageBox</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">",</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MB_OK);
                        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
               }
               </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">WM_DESTROY:
			PostQuitMessage (0);
			</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">default</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">:
			</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">DefWindowProc (hwnd, message, wParam, lParam);
    }
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">0;
}</span></pre>
</div>
<p>Now if you were to inject this DLL into another process, you would get something that looked like this:<br />
<img class="alignnone size-full wp-image-154" title="injectedwindow" src="http://sim0n.wordpress.com/files/2009/03/injectedwindow.png" alt="injectedwindow" width="601" height="423" /></p>
<p>Below is the complete code listing.<br />
<!--more--></p>
<div style="border:#660000 5px solid;">
<pre style="background-color:#ffffff;line-height:15px;color:#000000;padding:3px;"><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#include </span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"stdafx.h"
</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#include </span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"windows.h"

</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#define </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_EXIT         (WM_APP + 101)
</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">#define </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_MESSAGEBOX   (WM_APP + 102) 

HINSTANCE  inj_hModule;          </span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Injected Modules Handle
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">HWND       prnt_hWnd;            </span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Parent Window Handle

//WndProc for the new window
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">LRESULT CALLBACK DLLWindowProc (HWND, UINT, WPARAM, LPARAM);

</span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Register our windows Class
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">BOOL RegisterDLLWindowClass(</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">szClassName[])
{
    WNDCLASSEX wc;
    wc.hInstance =  inj_hModule;
	wc.lpszClassName = (LPCWSTR)L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">";</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
    wc.lpszClassName = (LPCWSTR)szClassName;
    wc.lpfnWndProc = DLLWindowProc;
    wc.style = CS_DBLCLKS;
    wc.cbSize = </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">sizeof </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(WNDCLASSEX);
    wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    wc.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    wc.hCursor = LoadCursor (NULL, IDC_ARROW);
    wc.lpszMenuName = NULL;
    wc.cbClsExtra = 0;
    wc.cbWndExtra = 0;
    wc.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(!RegisterClassEx (&#38;wc))
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">0;
}
</span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Creating our windows Menu
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">HMENU CreateDLLWindowMenu()
{
	HMENU hMenu;
	hMenu = CreateMenu();
	HMENU hMenuPopup;
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(hMenu==NULL)
        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">FALSE;
    hMenuPopup = CreatePopupMenu();
	AppendMenu (hMenuPopup, MF_STRING, MYMENU_EXIT, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">Exit</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">"));</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
    AppendMenu (hMenu, MF_POPUP, (UINT_PTR) hMenuPopup, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">File</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">

	hMenuPopup = CreatePopupMenu();
    AppendMenu (hMenuPopup, MF_STRING,MYMENU_MESSAGEBOX, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">MessageBox</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
    AppendMenu (hMenu, MF_POPUP, (UINT_PTR) hMenuPopup, TEXT</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">("</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">Test</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">")); </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">hMenu;
}

</span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//The new thread
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">DWORD WINAPI ThreadProc( LPVOID lpParam )
{
    MSG messages;
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">*pString = </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">reinterpret_cast</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">&#60;</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">wchar_t </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">* &#62; (lpParam);
	HMENU hMenu = CreateDLLWindowMenu();
	RegisterDLLWindowClass(L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">");</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	prnt_hWnd = FindWindow(L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Injected Into ClassName</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Injected Into Caption</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">");</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">
	HWND hwnd = CreateWindowEx (0, L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"InjectedDLLWindowClass</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">pString, WS_EX_PALETTEWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, prnt_hWnd, hMenu,inj_hModule, NULL );
	ShowWindow (hwnd, SW_SHOWNORMAL);
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">while </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(GetMessage (&#38;messages, NULL, 0, 0))
    {
		TranslateMessage(&#38;messages);
        DispatchMessage(&#38;messages);
    }
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">1;
}
</span><span style="color:#008000!important;font-family:Courier New!important;font-size:11px!important;">//Our new windows proc
</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">LRESULT CALLBACK DLLWindowProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">switch </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(message)
    {
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">WM_COMMAND:
               </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">switch</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(wParam)
               {
                    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_EXIT:
						SendMessage(hwnd, WM_CLOSE, 0, 0);
                        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
                    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MYMENU_MESSAGEBOX:
						MessageBox(hwnd, L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Test</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"MessageBox</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">",</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">MB_OK);
                        </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
               }
               </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">case </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">WM_DESTROY:
			PostQuitMessage (0);
			</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">break</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">;
		</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">default</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">:
			</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">DefWindowProc (hwnd, message, wParam, lParam);
    }
    </span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">0;
}

BOOL APIENTRY DllMain( HMODULE hModule, DWORD  ul_reason_for_call,LPVOID lpReserved)
{
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">if</span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">(ul_reason_for_call==DLL_PROCESS_ATTACH) {
		inj_hModule = hModule;
		CreateThread(0, NULL, ThreadProc, (LPVOID)L</span><span style="color:#a31515!important;font-family:Courier New!important;font-size:11px!important;">"Window Title</span><span style="color:#7f9698!important;font-family:Courier New!important;font-size:11px!important;">", </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">NULL, NULL);
	}
	</span><span style="color:#0000ff!important;font-family:Courier New!important;font-size:11px!important;">return </span><span style="color:rgb(-1,-1,-1)!important;font-family:Courier New!important;font-size:11px!important;">TRUE;
}</span></pre>
</div>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Managed Windows API library for .Net]]></title>
<link>http://devio.wordpress.com/2009/02/18/managed-windows-api-library-for-net/</link>
<pubDate>Wed, 18 Feb 2009 12:12:14 +0000</pubDate>
<dc:creator>devio</dc:creator>
<guid>http://devio.wordpress.com/2009/02/18/managed-windows-api-library-for-net/</guid>
<description><![CDATA[I mentioned accessing native Win32 APIs by .Net some time ago. Today I came across a Sourceforge pro]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I mentioned accessing native Win32 APIs by .Net <a href="http://devio.wordpress.com/2008/03/12/native-winapi-with-net/" target="_blank">some time ago</a>.</p>
<p>Today I came across a Sourceforge project called <a href="http://mwinapi.sourceforge.net/" target="_blank">Managed Windows API</a>, which provides a set of class to access various aspects of Win32. A couple of tools illustrate the use of the library.</p>
<p>I like TreeSizeSharp, a re-implementation of the TreeSize tool I often use if I find there&#8217;s not enough free space on my disks (again).</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Threads em C usando win32api]]></title>
<link>http://caelgomes.wordpress.com/2009/02/15/threads-em-c-usando-win32api/</link>
<pubDate>Sun, 15 Feb 2009 04:13:25 +0000</pubDate>
<dc:creator>caelgomes</dc:creator>
<guid>http://caelgomes.wordpress.com/2009/02/15/threads-em-c-usando-win32api/</guid>
<description><![CDATA[Hi there! Se tinha uma coisa que me segurava quando estava começando a programar era subdividir meu ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Hi there!</p>
<p>Se tinha uma coisa que me segurava quando estava começando a programar era subdividir meu programa. Sério. Até que isso se tornou insuportável quando tive que fazer um trabalho na facu, e escolhi usar <a href="http://pt.wikipedia.org/wiki/OpenGL" target="_blank">OpenGL</a>. DIgo, o usuário precisava digitar o que ele queria desenhar, entrar com os valores das medidas, e eu precisava desenhar. Oh Gosh! Minha saída foi usar <em>threads</em>, no que foi meu primeiro contado com Win32 API.</p>
<p>Sim, o trabalho ficou muito bom. Aliás, foi um puta trabalho em conjunto, meu, do <a href="http://twitter.com/vsportella" target="_blank">Ports</a> e do <a href="http://twitter.com/TRBaldim">Baldim</a>.</p>
<p>Tinha feito na época um .c todo comentado, tim-tim por tim-tim, até para futuras consultas. Pois bem, segue abaixo:</p>
<pre class="brush: cpp;">

 /*
    só para constar:
        DWORD = double word;
    ora, WORD é um tipo do tamanho básico da sua máquina;
    assim sendo, se vc tá programando para uma máquina x86 (32 bits), uma WORD terá 32 bits [4 bytes]
    e adivinha? uma variável do tipo DWORD terá o dobro!! (nesse caso, 64 bits, ou 8bytes)

    Agora, se vc é fodão e tá programando para uma plataforma 64 bits, então vc pega tudo oq eu falei acima,
    e multiplica por 2 !
    =)

    ooooutra coisa
        LPVOID = void *

    simples assim.
    */

#include &lt;cstdlib&gt;
#include &lt;iostream&gt;
#define WIN32_LEAN_AND_MEAN //para deixar a importação da windows.h mais 'light'
#include &lt;windows.h&gt; //todas funções aqui listadas estão no windows.h.
using namespace std;

DWORD WINAPI Thread(LPVOID);
/*
    Defini a função que será minha thread. O nome Thread não é reservado, ou seja, se eu quisesse que minha
    thread chamasse pnc, faria:
        DWORD WINAPI pnc(LPVOID);
    sem problemas.

    Como vc pode ver, a API do Windows utiliza ponteiros para controlar uma Thread. Por isso que vc passa um ponteiro na
    chamada. Segue abaixo a definição oficial:

    DWORD (WINAPI *LPTHREAD_START_ROUTINE)(LPVOID)

*/

int main(int argc, char *argv[])
{
    DWORD id_da_thread;
    HANDLE manipulador_thread = CreateThread(0,0,Thread,0,CREATE_SUSPENDED,&amp;id_da_thread); //retorna 0 se não criou, e o handle se criou
    int estado;
/*

    HANDLE WINAPI CreateThread(
    LPSECURITY_ATTRIBUTES ThreadAtt,
    SIZE_T Tamanho_da_Stack,
    LPTHREAD_START_ROUTINE sua_thread,
    LPVOID argumento,
    DWORD flags,
    LPDWORD id_da_sua_thread
    );  

    ThreadAtt:
    ponteiro para uma estrutura do tipo LPSECURITY_ATTRIBUTES que contém atributos de segurança da Thread.
    Se passado como ZERO, a Thread é criada com atributos padrões.

    Tamanho_da_Stack:
    tamanho que vc precisarah inicialmente da stack em bytes. Se ZERO, o sistema 'define' um tamanho padrão.
    Só é bom vc mexer nisso se vc souber oq vc tá fazendo...

    Argumento:
    um argumento opcional para a sua thread.

    Flags:
    Esse é importante: define o comportamento da Thread logo após ser criada.
    Vc pergunta: 'Mas como assim??'
    Eu digo:
        Se vc coloca um zero nisso, sua thread será 'executada automaticamente' ao ser criada...
        Ou seja, vai começar a executar o código que vc colocou lá, 'sozinha'.
        Agora, se vc colocar &quot;CREATE_SUSPENDED&quot; (sem as aspas, por favor), acontecerá o seguinte: a thread será criada,
        mas ela estará no 'pause', ou seja, ele existirá lá, bonitinha, e esperará vc dizer: 'rode filha, rode&quot;.
        Vc diz: &quot;Meu Deus, como eu faço pra dizer 'rode filha, rode' ???
        Fácil. Graças a Deus tem uma função chamada ResumeThread(HANDLE manipulador_thread) que faz isso pra vc!
        Ficou com dúvidas sobre o ResumeThread()? Tem a sintaxe lá embaixo..!!

    ThreadId:
    ponteiro (sim, ponteiro.. por isso que usei o '&amp;') para uma variável do tipo DWORD que irá armazenar a identificação
    da Thread. Se ZERO, o argumento é ignorado. 

    A função CreateThread() retorna um Handle para a thread criada, do contrário, é retornado um Handle Nulo, ou seja, ZERO.
*/

    if ( manipulador_thread == 0 ){ // não criou, manipulador é zero
        cout &lt;&lt; &quot;Não pude criar a thread&quot; &lt;&lt; endl;
        return 0;
    }

    cout &lt;&lt; &quot;Legal, criei a thread, vou exibir uma janela da sua main..&quot; &lt;&lt; endl;
    system(&quot;pause&quot;);
    MessageBox(0,&quot;MENSAGEM DA MAIN&quot;,&quot;Minha primeira Thread&quot;,0);

    cout &lt;&lt; &quot;Ok, agora vou \&quot;resumir\&quot; a thread...&quot; &lt;&lt; endl ;
    cout &lt;&lt; &quot;Fica esperto que assim que eu resumir, abrira um messagebox... &quot; &lt;&lt; endl;
    system(&quot;pause&quot;);

    if ( (ResumeThread(manipulador_thread)) == 0 ){
        cout &lt;&lt; &quot;Não consegui resumir a thread!!&quot; &lt;&lt; endl;
        exit(-1);
    }
    cout &lt;&lt; &quot;Thread resumida com sucesso...&quot; &lt;&lt; endl;

    cout &lt;&lt; &quot;Bye!&quot; &lt;&lt; endl;

    WaitForSingleObject(manipulador_thread, INFINITE);
/*
    DWORD WINAPI WaitForSingleObject(HANDLE manipulador_thread,DWORD tempo);

    manipulador_thread:
    manipulador da Thread;

    tempo:
    tempo em milisegundos que o programa deve aguardar.
    Caso a constante &quot;INFINITE&quot; seja especificada, o programa aguarda o tempo necessário até que a Thread seja finalizada,
    retornando um valor.

    é como se fosse um timer..
    ele vê: &quot;Hum, já se passaram XXX milisegundos.. hora de 'matar' a thread..!&quot;
*/

/*

    Então temos algumas funções importantes:

    *********************************
    BOOL  TerminateThread ( HANDLE seu_manipulador_thread, DWORD codigo_saida );

    OK, aqui é fácil, certo?
    vc vai terminar a Thread cuja seu manipulador manipula (foda-se a redundância), e vc também saberá
    se vc obteve sucesso no que vc tava rodando nela.. (basicamente é o return que vc implementou nela.)

    foda né?
    mas não é só isso...
    se vc reparou, essa função tem um retorno booleano! Se vc receber 0 é pq vc NÃO conseguiu 'matar' a thread.
    Bom, isso significa que vc se fodeu? Provavelmente sim, mas não necessariamente.
    MAS, se vc receber um 0 (false) é pq deu tudo certo (torça por isso...+) ).
    *********************************

    ****************
    CloseHandle(th);

    Esse acho que não precisa dizer mais nada, a não ser que é um pseudo-free().
    Lembre-se: chame-a por último... seja esperto.
    ****************
    */

    system(&quot;pause&quot;);
    TerminateThread(manipulador_thread,0);
    CloseHandle(manipulador_thread);
    return 0;

}
/* FUNCOES IMPORTANTES:

**************
    DWORD WINAPI SuspendThread(HANDLE manipulador_thread);

     maipulador_handle:
            manipulador da thread que se deseja pausar;

        A função retorna 1 se a thread especificada for interrompida corretamente,
        ou retorna 0, se o processo falhar.
*************

*************
DWORD WINAPI ResumeThread(HANDLE manipulador_thread);

     manipulador_thread:
            manipulador da thread que se deseja resumir;

    A função retorna o valor 1 se a thread for resumida corretamente,
    ou retorna 0, se falhar.
**************

*/

//aqui começa minha thread

DWORD WINAPI Thread(LPVOID valor)
{
    MessageBox(0,&quot;Mensagem da Thread&quot;,&quot;Aprendendo a mexer com Thread&quot;,0);
    return 0;
}
</pre>
<p>Espero que isso te ajude. É realmente muito simples&#8230; você cria, cria uma thread &#8211; mandando como parâmetro sua função, e então só controla seu funcionamento &#8211; pausa, suspende, continua, mata, etc&#8230;</p>
<p>Esse post é para aqueles que acham que foi o &#8220;Java que inventou as threads&#8221;. Tsc tsc&#8230;</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[Twitter-who?]]></title>
<link>http://caelgomes.wordpress.com/2008/12/26/twitter-who/</link>
<pubDate>Fri, 26 Dec 2008 15:43:33 +0000</pubDate>
<dc:creator>caelgomes</dc:creator>
<guid>http://caelgomes.wordpress.com/2008/12/26/twitter-who/</guid>
<description><![CDATA[Whoa! Todos sabemos o que é o Twitter, e sim, gostamos pra caramba dele! Não tem a poluição gentalha]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>Whoa!</p>
<p>Todos sabemos o que é o <a href="http://twitter.com/" target="_blank">Twitter</a>, e sim, gostamos pra caramba dele! Não tem a <span style="text-decoration:line-through;"><span>poluição</span> <span>gentalha</span> <span>gente feia</span></span> inconveniência costumeira do Orkut, e só por esse fato já deveria ser adorado. Enfim, isso é opinião, e a minha &#8211; e como você está no meu blog, por favor, respeite.</p>
<p>Senta que lá vem a história: Há tempos que queria fazer uma integração C com Java. Bom, então surgiu uma grande oportunidade, uma vez que a biblioteca mais digna que acessa a biblioteca do Twitter que achei foi a <a href="http://www.winterwell.com/software/jtwitter.php">JTwitter</a>, que realmente é muito boa e fácil de usar. Enfim, já tinha feito, há algum tempo (em tempos remotos de Infra na Amdocs), um código em C++ que listava os processos que estavam rodando. (De certo modo, acho que é meio redundante a última frase, mas whatever)</p>
<p>Lá vai um resumo: Tranformei meu código em C++ numa dll e, utilizando um negócio bem porco (como Java, em geral), chamado JNI (<a href="http://en.wikipedia.org/wiki/Java_Native_Interface">Java Native Interface</a>), fiz a integração do meu código em Java &#8211; que também utilizava a biblioteca JTwitter. Fiz um enhancement tolo para que reconhecesse <a href="http://help.twitter.com/index.php?pg=kb.page&#38;id=15">mensagens enviadas diretamente</a> para mim no Twitter, assim minha gororoba auto interagia com o meu suposto amigo, respondendo-o se eu estava ou não rodando tal processo  no momento. Sabe, falando agora, parece-me uma idéia tão ridícula&#8230; Mas foda-se.</p>
<p>Ingredientes:</p>
<p>- <a href="http://msdn.microsoft.com/en-us/library/ms682623(VS.85).aspx">Saber como</a> se acessa a API do WindowsX para listar processos. Tão ridículo que me dá comichões. Mas isso é assunto para outra hora.<br />
- <a href="http://www.cygwin.com/cygwin-ug-net/dll.html">Saber como</a> criar uma dll  &#8211; basicamente:</p>
<pre><em>gcc -shared -o minhadll.dll meuobjeto.o</em></pre>
<p>- <a href="http://forums.sun.com/thread.jspa?threadID=399184">Saber como</a> fazer a integração de C com Java.</p>
<p>Acho que o que vale explorar é esse último tópico. É facil &#8211; verdade &#8211; mas precisa de atenção. Vou descrever, depois mostro na prática.</p>
<p>Basicamente, você cria um código em Java que carrega uma dll &#8211; ignore o fato de ela não existir; pelo menos por enquanto. Ao tentar rodá-lo, <strong>obviamente</strong> você terá um erro de linkagem. Mas não queremos que funcione! Queremos só ver como seria feita a chamada dessa dll em C. Rápido demais? Certo. Repare que, mesmo dando erro, seu <em>javac</em> gerou um .class! Amazing. Mas isso não justifica minha fala agorinha. Não? Claro que sim!</p>
<p>Existe um utiliário que a Sun bota na JDK dela, se não me engano desde a 1.1, chamado <a href="http://java.sun.com/j2se/1.5.0/docs/tooldocs/windows/javah.html">Javah</a> (esse nome definitivamente me lembra os trocadilhos com Java, em tempos de técnico), que basicamente te gera headers e códigos em C a partir de uma .class.</p>
<p>Agora sim! Tudo se encaixa. Pseudo-criamos um código em Java com linkagem para nossa futura dll, vemos como fica a chamada em C/C++ usando o <em>javah</em>, fazemos um merge com nosso código na dll, compilamos-a, e enfim recompilamos nossa classe em Java que terá acesso ao Twitter!</p>
<p>Boralah, mãos a obra!</p>
<p>Código da DLL:</p>
<p>nomeei carinhosamente de <strong>TesteTwitter.cpp</strong></p>
<pre class="brush: cpp;">
#include &lt;jni.h&gt;
#include &quot;TesteTwitter.h&quot;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;windows.h&gt;
#include
&lt;psapi.h&gt;
#define     SIZE    1024

//some prototypes
int update_processes_array( DWORD *processes_array,
                            DWORD array_size,
                            DWORD *hm_processes,
                            DWORD bytes_returned);
int imprime_processo(DWORD pid);                            

/*
Procura o processo $nome. Se estiver rodando retorna seu PID, senão retorna 0
*/
int procura_processo(char * nome_processo){
    DWORD  * processes_array ; //array de processos, contem PIDs, e é do tamanho de SIZE
    DWORD  bytes_returned; //quantos processos tem no processes_array
    DWORD  array_size; //double word que armazenará o SIZE definido
    DWORD  hm_processes; //how many processes <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    HANDLE handle_processo;
    int i; //contador
    char nome[1024]; //armazenará o nome do módulo, null se der pau
    char *nome_upper; //diferencas de case
    //char * nome_processo_upper;
    nome_upper = (char *) malloc(sizeof(char)*1024);
    //nome_processo_upper = (char *) malloc(sizeof(char)*1024);

    if (nome_processo == NULL &amp;#124;&amp;#124; strlen(nome_processo) &lt; 4 )
    // evita burrice, lembre-se: vc tá no windows, o strlen(processo) mínimo que vc tem é 4,
    // ou seja, .xxx  - extensão, meu fillho!
    {
        return 0; //fala que não achou
    }
    strcpy(nome,&quot;null&quot;);//como dito <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    array_size = SIZE; //blah
    //alloc memory for processes' array
    processes_array = ( DWORD * ) malloc( sizeof(DWORD) * SIZE );
    //atualiza o array de processos <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />
    if ( hm_processes = update_processes_array(processes_array, array_size, &amp;hm_processes, bytes_returned) ){
        printf(&quot;Array de Processos atualizado com sucesso&quot;);
    }else{
        printf(&quot;Erro ao atualizar lista de processos&quot;);
        return 0;
    }

    printf(&quot;\nNo momento, temos %d processos.&quot;, hm_processes);
    for (i=0; i&lt;hm_processes; i++){
        //tenta pegar um handle pro processo, but retorna null se der pau
         handle_processo = OpenProcess(PROCESS_QUERY_INFORMATION &amp;#124; PROCESS_VM_READ, FALSE, processes_array[i]);
         //consegui? então pega o moduleBaseName!
         if( handle_processo != NULL){
             HMODULE vetor_handle_modulo;
             DWORD tamanho;
             if(EnumProcessModules(handle_processo, &amp;vetor_handle_modulo, sizeof(vetor_handle_modulo), &amp;tamanho)){
                 GetModuleBaseName( handle_processo, vetor_handle_modulo, nome, sizeof(nome)/sizeof(char));
             }
        }

        nome_upper = strupr(strdup(nome));
        nome_processo = strupr(strdup(nome_processo));
        if(! strcmp(nome_processo,nome_upper) ){  //ve se o processo atual (processes_array[i]) é o processo que estamos looking for.
            printf(&quot;\nAchei o %s&quot;, nome);
            CloseHandle(handle_processo);
            return (int)processes_array[i];
        }
    }
    printf(&quot;\nProcess %s not found!&quot;,nome_processo);
}

bool get_Processes( DWORD * processes_array,
                    DWORD size_processes_array,
                    DWORD *bytes_returned)
{

    if ( EnumProcesses( processes_array , size_processes_array , bytes_returned ) )
        return true;
    else
        return false;

}

/*
Recebe um PID e imprime (ou pelo menos tenta imprimir) seu module name
*/
int imprime_processo( DWORD pid ){
     //armazenará o nome do módulo, null se der pau
     char nome[1024];
     strcpy(nome,&quot;null&quot;);
     //tenta pegar um handle pro processo, but retorna null se der pau
     HANDLE handle_processo = OpenProcess(PROCESS_QUERY_INFORMATION &amp;#124; PROCESS_VM_READ, FALSE, pid);
     //consegui? então pega o moduleBaseName!
     if( handle_processo != NULL){
         HMODULE vetor_handle_modulo;
         DWORD tamanho;
         if(EnumProcessModules(handle_processo, &amp;vetor_handle_modulo, sizeof(vetor_handle_modulo), &amp;tamanho)){
             GetModuleBaseName( handle_processo, vetor_handle_modulo, nome, sizeof(nome)/sizeof(char));
         }
    }
    printf(&quot;%u  -  %s&quot;, pid, nome);
    CloseHandle(handle_processo);
    if(pid)
        return pid;
    return 0;
}

/*
returns:
    &lt; -1  &gt;     -    if fails on get_processes function
    &lt; &gt;= 0 &gt;    -    how many processes are running at this moment
*/
int update_processes_array( DWORD *processes_array,
                            DWORD array_size,
                            DWORD *hm_processes,
                            DWORD bytes_returned){
    if (! get_Processes( processes_array , array_size , &amp;bytes_returned) )
            return -1;
        else
            return *hm_processes = bytes_returned / sizeof(DWORD) ;

}

JNIEXPORT jint JNICALL Java_TesteTwitter_escreve(JNIEnv *env , jobject obj, jstring processo)
{
//Meu Deus, que palavras feias são essas! Pois é, também acho. Isso vem do .h gerado ao vc rodar o javah
//que, aliás, não disse comofas:
// javah classe_java
//ele vai te gerar um .h. A partir dele, vc se vira.
        int resultado = 0;
        jboolean iscopy; //boolean do java
        const char  *nome_processo = (env) -&gt; GetStringUTFChars(processo,&amp;iscopy);
        if (nome_processo == NULL){
            return 0; // erro em alocação de memória
        }
        printf(&quot;\n%s\n&quot;,nome_processo);
        resultado = procura_processo((char *)nome_processo);
        return resultado;
}
</pre>
<p>Seria legal se você tirasse, depois de entender o código e vê-lo rodar, todos os printf()&#8217;s da DLL. Isso não se faz.</p>
<p>Você também vai precisar de um arquivo <a href="http://msdn.microsoft.com/en-us/library/28d6s79h(VS.80).aspx">.def</a>, contendo informações básicas, tipo:</p>
<p>Java_Programa_método-a-ser-exportado</p>
<pre class="brush: cpp;">

EXPORTS
Java_TesteTwitter_escreve
</pre>
<p>Agora, bora compilar isso. Pay attention here!!</p>
<p>Primeiro você vai gerar um .o, nos moldes simples:</p>
<pre class="brush: cpp;">

gcc -c -I&quot;path que vc quiser incluir (onde estiverem libraries que vc botou no include, por exemplo)&quot; -o nome_do_objeto.o sourcecode.cpp
</pre>
<p>Importante você saber que, como você está usando a JNI.h, você precisa colocar o Path de seu header e implementação (JDK_folder\include e JDK_folder\include\win32). Ficaria algo do gênero:</p>
<pre class="brush: cpp;">

gcc -c -I&quot;C:\Arquivos de programas\java\jdk1.6.0_11\include&quot; -I&quot;C:\Arquivos de programas\java\jdk1.6.0_11\include\win32&quot; -o TesteTwitter.o TesteTwitter.cpp
</pre>
<p>Agora que você já tem seu nome_do_objeto.o, mande bala:</p>
<pre class="brush: cpp;">

gcc -shared -o&quot;meu_path\minhadll.dll&quot; &quot;meu_path\nome_do_objeto.o&quot; &quot;meu_path\meu_file_de_definicao.def&quot; -lpsapi

//ou, pegando na sua mão,

gcc -shared -o&quot;C:\Users\Cael\TesteTwitter.dll&quot;  &quot;C:\users\Cael\TesteTwitter.o&quot; &quot;C:\Users\cael\TesteTwitter.def&quot; -lpsapi

//coisa que vc precisa saber: -lpsapi diz ao gcc que vc está usando rotinas da biblioteca PSAPI. Óbvio.
</pre>
<p>Se tudo der certo, você tem sua DLL!</p>
<p>Agora vamos a parte do Java (eu sei, eu sei, fazer o quê.. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  )</p>
<pre class="brush: java;">

import java.util.List;
import winterwell.jtwitter.*; //dando import na library JTwitter
import winterwell.jtwitter.Twitter.Message;

public class TesteTwitter {
    static long ultimo=45871821; //ID da mensagem que, a partir dela, o código irá responder
    public native int escreve(String processo);   
    static{
    System.load(&quot;C:/Users/Cael/TesteTwitter.dll&quot;);
    System.out.println(&quot;Loaded&quot;);
    }
    public static void main(String[] args) {
        int PID;
        List&lt;Message&gt; lista;
        Message mensagem;
        Twitter cael = new Twitter(&quot;meu_login&quot;,&quot;minha_senha&quot;); //preciso te lembrar de alterar?
        while (1==1){
            try {
                Thread.currentThread().sleep(60000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(cael.getRateLimitStatus());
            lista=cael.getDirectMessages();
            if (lista.size() &gt; 0){
                mensagem = lista.get(0);
                System.out.println(mensagem.getText());
                if (mensagem.getId() != ultimo){

                    /*DEBUGGER*/

                    System.out.println(&quot;Mensagem nova!&quot;);
                    System.out.println(&quot;DE: &quot; + mensagem.getSender());
                    System.out.println(&quot;TEXTO: &quot; + mensagem.getText());

                    /*END*/

                    PID = new TesteTwitter().escreve(mensagem.getText());
                    if (PID !=0){
                        cael.setStatus(&quot;@&quot; + mensagem.getSender().screenName +  &quot; Sim, estou rodando o &quot; + mensagem.getText() + &quot;. PID &quot; + PID);
                    }else{
                        cael.setStatus(&quot;@&quot; + mensagem.getSender().screenName +  &quot; Não estou rodando o &quot; + mensagem.getText() + &quot;. Retorno da API (PID) &quot; + PID );

                    }
                    ultimo = mensagem.getId();
                    System.out.println(&quot;Twitter respondido!&quot;);
                    System.out.println(&quot;Para &quot; + mensagem.getSender());
                    System.out.println(&quot;ULTIMO = &quot; + ultimo);
                }           
            }
        }
    }
}
</pre>
<p>Warnings:</p>
<p>- O Twitter tem uma política de acesso aos seus dados via API. Sugiro que você dê uma pesquisada, antes que tenha sua conta bloqueada (como eu) por algumas horas. Isso te explica o Sleep() no código.</p>
<p>- Sim, o código tá muito verbose. Portanto, altere-o do jeito que você quiser.</p>
<p>- A variável estática <em>ultimo</em> está sendo atualizada durante a execução. E somente durante. Você pode alterá-la, salvá-la, armazená-la do jeito que você quiser após rodar o código. Senão, toda vez que você rodar, ele vai responder tudo de novo. Eu ainda estou no CTRL+C/V, pois não quero gastar muito tempo com esse assunto, e porque, principalmente, odeio Java.</p>
<p>Fiz uns updates para criar e matar processos remotamente, coisa fácil. Vá na pagina do msdn que te passei o link, comece a fuçar por lá. Mas cuidado com isso, não deixe ninguém rodar processo remotamente na sua máquina. Ou deixe. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Dúvidas, sugestões, declarações de amor ou xingamentos, comente.</p>
<p>Abraços,</p>
<p>Cael</p>
</div>]]></content:encoded>
</item>
<item>
<title><![CDATA[The Desktop Dog - loading Fallout2 frm files]]></title>
<link>http://apavlov.wordpress.com/2008/11/23/the-desktop-dog-loading-fallout2-frm-files/</link>
<pubDate>Sun, 23 Nov 2008 19:29:19 +0000</pubDate>
<dc:creator>apavlov</dc:creator>
<guid>http://apavlov.wordpress.com/2008/11/23/the-desktop-dog-loading-fallout2-frm-files/</guid>
<description><![CDATA[I like Fallout. Since 10 years I still play Fallout2 at least once a year. And I got an idea to use ]]></description>
<content:encoded><![CDATA[<div class='snap_preview'><p>I like Fallout. Since 10 years I still play Fallout2 at least once a year. And I got an idea to use Fallout characters for my desktop application. I decided to get original FRM files, add them as application resources and then convert them to bitmaps.<br />
It took just a few minutes to find FRM file format specs <a href="http://falloutmods.wikia.com/wiki/Frm_files">here</a> and a couple of useful programs:</p>
<ul>
<li>unDAT 1.01 &#8211; for extracting resource files out of game .dat archives.</li>
<li>Viewer for FALLOUT2 v1.3 &#8211; for viewing unpacked FRM files.</li>
</ul>
<p>I used Cyberdog as main character, and the Child as additional character. Cyberdog runs after mouse cursor, and 3 children just walk on a screen. Additionally, children are running from Cyberdog.</p>
<p><a href="http://apavlov.files.wordpress.com/2008/11/desktopfallout.png"><img class="aligncenter size-full wp-image-78" title="desktopfallout" src="http://apavlov.wordpress.com/files/2008/11/desktopfallout.png" alt="desktopfallout" width="292" height="186" /></a></p>
<p><a href="http://apavlov.files.wordpress.com/2008/11/desktopfallout.doc">This is</a> the project and exe file (as usual, rename .doc to .zip after downloading). Enjoy! Btw, program has no interface. Use Task Manager to exit <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
</div>]]></content:encoded>
</item>

</channel>
</rss>
