本文整理汇总了C++中LoadResource函数的典型用法代码示例。如果您正苦于以下问题:C++ LoadResource函数的具体用法?C++ LoadResource怎么用?C++ LoadResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LoadResource函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: stAttachDebugger
void
stAttachDebugger(
DWORD processId,
std::string fnIncludes,
std::string fnExcludes,
bool activeProcess = true)
/*++
Routine Description:
Our mini-debugger implementation. It does following
things:
- Attach to a running process
- On first breakpoint, inject the IAT patching DLL into target
- Print information of any exception in target process
- Print the debug spew from target process
Arguments:
processId - PID of the process to attach
fnIncludes - List of include filters
fnExclude - List of exclude filters
activeProcess - If we are attaching to an already running process
then we pass activeProcess = true, this causes us to call
DebugActiveProcess and not wait for process creation event
--*/
{
int threadCount = 0;
bool processInfected = false;
if (activeProcess)
{
if (!DebugActiveProcess(processId))
{
gView->PrintError(L"\nCould not attach to the process (PID = %d).", processId);
stHandleError(GetLastError());
goto funcExit;
}
}
HMODULE hMod = GetModuleHandle(L"Kernel32.dll");
if (hMod)
{
PFNDEBUGSETPROCESSKILLONEXIT pfnDebugSetProcessKillOnExit =
(PFNDEBUGSETPROCESSKILLONEXIT)GetProcAddress(hMod, "DebugSetProcessKillOnExit");
if (pfnDebugSetProcessKillOnExit)
{
pfnDebugSetProcessKillOnExit(FALSE);
}
}
gProcessId = processId;
DEBUG_EVENT debugEvent;
DWORD dwContinueStatus = DBG_CONTINUE;
bool keepAlive = true;
while(keepAlive)
{
WaitForDebugEvent(&debugEvent, INFINITE);
dwContinueStatus = DBG_CONTINUE;
if (debugEvent.dwProcessId == processId)
{
switch (debugEvent.dwDebugEventCode)
{
case EXCEPTION_DEBUG_EVENT:
{
switch (debugEvent.u.Exception.ExceptionRecord.ExceptionCode)
{
case EXCEPTION_BREAKPOINT:
{
//IHU_DBG_LOG(TRC_STRACE, HX_LEVEL_INFO, (L"EXCEPTION_BREAKPOINT\n"));
if (!processInfected)
{
if (gRemovePatchOnExit)
{
HRSRC hRes;
HGLOBAL hResG;
LPVOID pRes;
DWORD dwResSize;
hRes = FindResource(
NULL,
MAKEINTRESOURCE(IDR_BIN_DLL),
L"BIN");
hResG = LoadResource(NULL, hRes);
pRes = LockResource(hResG);
dwResSize = SizeofResource(NULL, hRes);
wchar_t tempPath[MAX_PATH];
//.........这里部分代码省略.........
开发者ID:Tener,项目名称:ihpublic,代码行数:101,代码来源:strace.cpp
示例2: FindResource
dictionary* INI::LoadIniFile(HINSTANCE hInstance, LPSTR inifile)
{
dictionary* ini = NULL;
// First attempt to load INI from exe
HRSRC hi = FindResource(hInstance, MAKEINTRESOURCE(1), RT_INI_FILE);
if(hi) {
HGLOBAL hg = LoadResource(hInstance, hi);
PBYTE pb = (PBYTE) LockResource(hg);
DWORD* pd = (DWORD*) pb;
if(*pd == INI_RES_MAGIC) {
ini = iniparser_load((char *) &pb[RES_MAGIC_SIZE], true);
if(!ini) {
Log::Warning("Could not load embedded INI file");
}
}
}
// Check if we have already loaded an embedded INI file - if so
// then we only need to load and merge the INI file (if present)
if(ini && iniparser_getboolean(ini, ALLOW_INI_OVERRIDE, 1)) {
dictionary* ini2 = iniparser_load(inifile);
if(ini2) {
for(int i = 0; i < ini2->n; i++) {
char* key = ini2->key[i];
char* value = ini2->val[i];
iniparser_setstr(ini, key, value);
}
iniparser_freedict(ini2);
}
} else if(!ini) {
ini = iniparser_load(inifile);
if(ini == NULL) {
Log::Error("Could not load INI file: %s", inifile);
return NULL;
}
}
// Expand environment variables
ExpandVariables(ini);
// Now check if we have an external file to load
char* iniFileLocation = iniparser_getstr(ini, INI_FILE_LOCATION);
if(iniFileLocation) {
Log::Info("Loading INI keys from file location: %s", iniFileLocation);
dictionary* ini3 = iniparser_load(iniFileLocation);
if(ini3) {
for(int i = 0; i < ini3->n; i++) {
char* key = ini3->key[i];
char* value = ini3->val[i];
iniparser_setstr(ini, key, value);
}
iniparser_freedict(ini3);
} else {
Log::Warning("Could not load INI keys from file: %s", iniFileLocation);
}
}
// Attempt to parse registry location to include keys if present
ParseRegistryKeys(ini);
iniparser_setstr(ini, MODULE_INI, inifile);
// Add module name to ini
TCHAR filename[MAX_PATH], filedir[MAX_PATH];
GetModuleFileName(hInstance, filename, MAX_PATH);
iniparser_setstr(ini, MODULE_NAME, filename);
// strip off filename to get module directory
GetFileDirectory(filename, filedir);
iniparser_setstr(ini, MODULE_DIR, filedir);
// stip off filename to get ini directory
GetFileDirectory(inifile, filedir);
iniparser_setstr(ini, INI_DIR, filedir);
// Log init
Log::Init(hInstance, iniparser_getstr(ini, LOG_FILE), iniparser_getstr(ini, LOG_LEVEL), ini);
Log::Info("Module Name: %s", filename);
Log::Info("Module INI: %s", inifile);
Log::Info("Module Dir: %s", filedir);
Log::Info("INI Dir: %s", filedir);
// Store a reference to be used by JNI functions
g_ini = ini;
return ini;
}
开发者ID:PATRONAS,项目名称:xlloop,代码行数:88,代码来源:INI.cpp
示例3: SAFE_DELETE_ARRAY
//-----------------------------------------------------------------------------
// Name: CWaveFile::Open()
// Desc: Opens a wave file for reading
//-----------------------------------------------------------------------------
HRESULT CWaveFile::Open( LPTSTR strFileName, WAVEFORMATEX* pwfx, DWORD dwFlags )
{
HRESULT hr;
m_dwFlags = dwFlags;
m_bIsReadingFromMemory = FALSE;
if( m_dwFlags == WAVEFILE_READ )
{
if( strFileName == NULL )
return E_INVALIDARG;
SAFE_DELETE_ARRAY( m_pwfx );
m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF | MMIO_READ );
if( NULL == m_hmmio )
{
HRSRC hResInfo;
HGLOBAL hResData;
DWORD dwSize;
VOID* pvRes;
// Loading it as a file failed, so try it as a resource
if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAVE") ) ) )
{
if( NULL == ( hResInfo = FindResource( NULL, strFileName, TEXT("WAV") ) ) )
return DXTRACE_ERR( TEXT("FindResource"), E_FAIL );
}
if( NULL == ( hResData = LoadResource( NULL, hResInfo ) ) )
return DXTRACE_ERR( TEXT("LoadResource"), E_FAIL );
if( 0 == ( dwSize = SizeofResource( NULL, hResInfo ) ) )
return DXTRACE_ERR( TEXT("SizeofResource"), E_FAIL );
if( NULL == ( pvRes = LockResource( hResData ) ) )
return DXTRACE_ERR( TEXT("LockResource"), E_FAIL );
m_pResourceBuffer = new CHAR[ dwSize ];
memcpy( m_pResourceBuffer, pvRes, dwSize );
MMIOINFO mmioInfo;
ZeroMemory( &mmioInfo, sizeof(mmioInfo) );
mmioInfo.fccIOProc = FOURCC_MEM;
mmioInfo.cchBuffer = dwSize;
mmioInfo.pchBuffer = (CHAR*) m_pResourceBuffer;
m_hmmio = mmioOpen( NULL, &mmioInfo, MMIO_ALLOCBUF | MMIO_READ );
}
if( FAILED( hr = ReadMMIO() ) )
{
// ReadMMIO will fail if its an not a wave file
mmioClose( m_hmmio, 0 );
return DXTRACE_ERR( TEXT("ReadMMIO"), hr );
}
if( FAILED( hr = ResetFile() ) )
return DXTRACE_ERR( TEXT("ResetFile"), hr );
// After the reset, the size of the wav file is m_ck.cksize so store it now
m_dwSize = m_ck.cksize;
}
else
{
m_hmmio = mmioOpen( strFileName, NULL, MMIO_ALLOCBUF |
MMIO_READWRITE |
MMIO_CREATE );
if( NULL == m_hmmio )
return DXTRACE_ERR( TEXT("mmioOpen"), E_FAIL );
if( FAILED( hr = WriteMMIO( pwfx ) ) )
{
mmioClose( m_hmmio, 0 );
return DXTRACE_ERR( TEXT("WriteMMIO"), hr );
}
if( FAILED( hr = ResetFile() ) )
return DXTRACE_ERR( TEXT("ResetFile"), hr );
}
return hr;
}
开发者ID:rohstar,项目名称:game-programming,代码行数:87,代码来源:DirectSound.cpp
示例4: hf
Resource::Resource (const TCHAR* name) : hf(0), hr(0) {
hf = FindResource(NULL, name, MAKEINTRESOURCE(RT_RCDATA));
if (hf) hr = LoadResource(NULL, hf);
}
开发者ID:qtnc,项目名称:Snippet-zone,代码行数:4,代码来源:Resource.cpp
示例5: ASSERT
BOOL CWindowsMetaFile::GetMetaFile(HINSTANCE hInstance, LPCSTR pszResource, LPCSTR pszType, ALDUS_WMF_HEADER* pAldusHeader, METAHEADER* pHeader, HMETAFILE* phMetaFile)
{
BOOL fSuccess = FALSE;
ASSERT(hInstance != NULL);
ASSERT(pszResource != NULL);
ASSERT(pszType != NULL);
HRSRC hrResource;
hrResource = FindResource(hInstance, pszResource, pszType);
if (hrResource != NULL)
{
HGLOBAL hResource;
hResource = LoadResource(hInstance, hrResource);
if (hResource != NULL)
{
LPBYTE pResource;
#ifdef WIN32
DWORD dwGlobalSize = 0;
#else
DWORD dwGlobalSize = GlobalSize(hResource);
#endif
pResource = (LPBYTE)LockResource(hResource);
if (pResource != NULL)
{
ASSERT((dwGlobalSize == 0) || (dwGlobalSize >= sizeof(ALDUS_WMF_HEADER)+sizeof(METAHEADER)));
if ((dwGlobalSize == 0) || (dwGlobalSize >= sizeof(ALDUS_WMF_HEADER)+sizeof(METAHEADER)))
{
// Save the Aldus header if the user has requested it.
if (pAldusHeader != NULL)
{
*pAldusHeader = *((ALDUS_WMF_HEADER*)pResource);
}
// Validate the Aldus header.
if (((ALDUS_WMF_HEADER*)pResource)->key == ALDUS_WMF_KEY)
{
// Save the metafile header if the user has requested it.
if (pHeader != NULL)
{
*pHeader = *((METAHEADER*)(pResource+sizeof(ALDUS_WMF_HEADER)));
}
// Get the size from the metafile header.
DWORD dwSize = ((METAHEADER*)(pResource+sizeof(ALDUS_WMF_HEADER)))->mtSize*2;
if (dwGlobalSize != 0 && dwGlobalSize < sizeof(ALDUS_WMF_HEADER)+dwSize)
{
// This can be cause by the WMF files where mtSize includes the
// size of the Aldus header. Attempt to adjust for this by
// decreasing mtSize.
dwSize -= sizeof(ALDUS_WMF_HEADER);
}
if (dwSize != 0)
{
ASSERT((dwGlobalSize == 0) || (dwGlobalSize >= sizeof(ALDUS_WMF_HEADER)+dwSize));
if ((dwGlobalSize == 0) || (dwGlobalSize >= sizeof(ALDUS_WMF_HEADER)+dwSize))
{
// If the user wants a metafile handle, continue.
// Otherwise, return TRUE.
fSuccess = phMetaFile == NULL;
if (!fSuccess)
{
*phMetaFile = NULL;
// Allocate the memory to hold the metafile data.
HGLOBAL hMetaFileData;
hMetaFileData = GlobalAlloc(GMEM_MOVEABLE|GMEM_SHARE, dwSize);
if (hMetaFileData != NULL)
{
LPVOID pMetaFileData;
pMetaFileData = GlobalLock(hMetaFileData);
if (pMetaFileData != NULL)
{
// Copy the meta file data from the resource into the new memory block.
// We have now read the data, make a metafile from it.
#ifdef WIN32
memcpy(pMetaFileData, (LPVOID)(pResource+sizeof(ALDUS_WMF_HEADER)), dwSize);
*phMetaFile = ::SetMetaFileBitsEx(dwSize, (LPBYTE)pMetaFileData);
//.........这里部分代码省略.........
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:101,代码来源:CWMF.CPP
示例6: loadIcon32
int loadIcon32(HGDIOBJ& image, HINSTANCE hInst, LPCTSTR id , int size , int bits, bool preferIcon) {
image = 0;
HRSRC hr;
HGLOBAL hg;
int imageType=-1;
void * p = 0;
if (!hInst) {
FILE * file = fopen(id , "rb");
if (!file) goto end;
fseek(file , 0 , SEEK_END);
int size = ftell(file);
rewind(file);
if (size < SIZEOF_NEWHEADER) {fclose(file); return 0;}
p = malloc(size);
fread(p , 1 , size , file);
fclose(file);
} else {
hr = FindResource(hInst , id , RT_GROUP_ICON);
if (!hr) goto end;
hg = LoadResource(hInst , hr);
if (!hg) goto end;
p = LockResource(hg);
if (!p) goto end;
}
NEWHEADER * nh = (NEWHEADER *)p;
RESDIR * rd;
rd = (RESDIR *)((long)p+SIZEOF_NEWHEADER);
RESDIR* found = 0;
int rsize = 0;
int sizev = size; // rozmiar pionowy
for (int i = 0; i < nh->ResCount; i++ , rd++) {
if (rd->ResInfo.Icon.Width == size || !found) {
if (!size) size = rd->ResInfo.Icon.Width;
if (rd->BitCount <= bits || !found) {
//found = hInst?rd->IconCursorId & 0xFFFF : rd->IconCursorId;
found = rd;
rsize = rd->BytesInRes;
sizev = rd->ResInfo.Icon.Width == rd->ResInfo.Icon.Height
?size : ceilf(float(size / rd->ResInfo.Icon.Width) * rd->ResInfo.Icon.Height);
}
if (rd->ResInfo.Icon.Width == size && rd->BitCount == bits) break;
}
if (hInst) rd = (RESDIR*)((char*)rd - 2); // Korygujemy pozycjê...
}
if (!found) goto end;
void * p2 = 0;
if (!hInst) {
p2 = (char*)p + found->IconCursorId;
} else {
hr = FindResource(hInst , MAKEINTRESOURCE(found->IconCursorId & 0xFFFF) , RT_ICON);
if (!hr) goto end;
hg = LoadResource(hInst , hr);
// = SizeofResource(hInst , hr);
if (!hg || !rsize) goto end;
p2 = LockResource(hg);
if (!p2) goto end;
}
if (found->BitCount == 32 && (!isComctl(6,0) || !preferIcon)) {
BITMAPV5HEADER bi;
BITMAPV5HEADER* _bi = (BITMAPV5HEADER*)p2;
ZeroMemory(&bi,sizeof(BITMAPV5HEADER));
bi.bV5Size = sizeof(BITMAPV5HEADER);
bi.bV5Width = _bi->bV5Width;
bi.bV5Height = _bi->bV5Height / 2;
bi.bV5Planes = _bi->bV5Planes;
bi.bV5BitCount = 32;
bi.bV5Compression = BI_BITFIELDS;
bi.bV5RedMask = 0x00FF0000;
bi.bV5GreenMask = 0x0000FF00;
bi.bV5BlueMask = 0x000000FF;
bi.bV5AlphaMask = 0xFF000000;
void * bmpData;
char* _bmpData = (char*)p2 + _bi->bV5Size;
HDC hdc;
hdc = GetDC(NULL);
// Create the DIB section with an alpha channel.
image = (HGDIOBJ)CreateDIBSection(hdc, (BITMAPINFO *)&bi, DIB_RGB_COLORS, (void **)&bmpData, NULL, (DWORD)0);
memcpy(bmpData, _bmpData, bi.bV5Width * bi.bV5Height * 4);
ReleaseDC(0, hdc);
if (found->ResInfo.Icon.Width != size || found->ResInfo.Icon.Height != sizev) {
// zmiana rozmiaru
}
imageType = IMAGE_BITMAP;
} else {
image = (HGDIOBJ)CreateIconFromResourceEx((PBYTE)p2 , rsize , true , 0x00030000 , size , sizev , 0);
imageType = IMAGE_ICON;
}
end:
if (!hInst && p)
free(p);
return imageType;
//.........这里部分代码省略.........
开发者ID:Konnekt,项目名称:staminalib,代码行数:101,代码来源:WinHelper.cpp
示例7: DialogWithHelp
dlgHbaConfig::dlgHbaConfig(pgFrame *parent, pgHbaConfigLine *_line, pgConn *_conn) :
DialogWithHelp((frmMain *)parent)
{
wxWindowBase::SetFont(settings->GetSystemFont());
LoadResource((wxWindow *)parent, wxT("dlgHbaConfig"));
conn = _conn;
userAdding = databaseAdding = false;
// Icon
SetIcon(*property_png_ico);
RestorePosition();
line = _line;
cbType->Append(wxT("local"));
cbType->Append(wxT("host"));
cbType->Append(wxT("hostssl"));
cbType->Append(wxT("hostnossl"));
cbDatabase->Append(wxT("all"));
cbDatabase->Append(wxT("sameuser"));
cbDatabase->Append(wxT("@<filename>"));
if (conn)
{
// role is supported from 8.1
if (conn->BackendMinimumVersion(8, 1))
cbDatabase->Append(wxT("samerole"));
else
cbDatabase->Append(wxT("samegroup"));
// replication is supported from 9.0
if (conn->BackendMinimumVersion(9, 0))
cbDatabase->Append(wxT("replication"));
}
else
{
cbDatabase->Append(wxT("samegroup"));
cbDatabase->Append(wxT("samerole"));
cbDatabase->Append(wxT("replication"));
}
cbUser->Append(wxT("all"));
cbMethod->Append(wxT("trust"));
cbMethod->Append(wxT("reject"));
cbMethod->Append(wxT("md5"));
cbMethod->Append(wxT("password"));
cbMethod->Append(wxT("krb4"));
cbMethod->Append(wxT("krb5"));
cbMethod->Append(wxT("ident"));
cbMethod->Append(wxT("pam"));
if (conn)
{
// LDAP is supported from 8.2
if (conn->BackendMinimumVersion(8, 2))
cbMethod->Append(wxT("ldap"));
// GSS/SSPI are supported from 8.3
if (conn->BackendMinimumVersion(8, 3))
{
cbMethod->Append(wxT("gss"));
cbMethod->Append(wxT("sspi"));
}
// CERT is supported from 8.4
// but crypt is no longer supported in 8.4
if (conn->BackendMinimumVersion(8, 4))
{
cbMethod->Append(wxT("cert"));
}
else
{
cbMethod->Append(wxT("crypt"));
}
// Radius is supported from 9.0
if (conn->BackendMinimumVersion(9, 0))
{
cbMethod->Append(wxT("radius"));
}
// Peer is supported from 9.1
if (conn->BackendMinimumVersion(9, 1))
{
cbMethod->Append(wxT("peer"));
}
}
else
{
// Add all version-dependent methods if we don't know what version we have.
cbMethod->Append(wxT("ldap"));
cbMethod->Append(wxT("gss"));
cbMethod->Append(wxT("sspi"));
cbMethod->Append(wxT("cert"));
cbMethod->Append(wxT("crypt"));
cbMethod->Append(wxT("radius"));
cbMethod->Append(wxT("peer"));
//.........这里部分代码省略.........
开发者ID:Joe-xXx,项目名称:pgadmin3,代码行数:101,代码来源:dlgHbaConfig.cpp
示例8: CreateMainWindow
int
CreateMainWindow(HINSTANCE hInstance, HWND hWnd, LPCTSTR name, int cmdbar_height)
{
HRSRC res;
unsigned char *mem;
int i;
DLGTEMPLATE dlg;
DLGITEMTEMPLATE item;
RECT rect;
int ratio_x, ratio_y;
res = FindResource(hInstance, name, RT_DIALOG);
if (res == NULL) {
debug_printf(TEXT("error=%d\n"), GetLastError());
}
mem = (unsigned char*)LockResource(LoadResource(NULL, res));
/*
* DLGTEMPLATE structure
*/
dlg = *(DLGTEMPLATE*)mem;
mem += sizeof(DLGTEMPLATE);
GetClientRect(hWnd, &rect);
rect.top += cmdbar_height; /* get client rect w/o command bar */
ratio_x = (rect.right - rect.left) * 100 / dlg.cx;
ratio_y = (rect.bottom - rect.top) * 100 / dlg.cy;
/*
* menu resource
*/
if (*(WORD*)mem == 0xffff) {
/* predefined menu */
mem += sizeof(WORD);
debug_printf(TEXT("Dlg: menu=%04x\n"), *(WORD*)mem);
mem += sizeof(WORD);
} else
if (*(WORD*)mem == 0x0000) {
/* no menu */
mem += sizeof(WORD);
debug_printf(TEXT("Dlg: menu=none\n"));
} else {
/* menu resource name */
debug_printf(TEXT("Dlg: menu=%s\n"), (TCHAR*)mem);
while (*(WORD*)mem) { /* zero terminated */
mem += sizeof(WORD);
}
mem += sizeof(WORD);
}
/*
* window class
*/
if (*(WORD*)mem == 0xffff) {
/* predefined class */
mem += sizeof(WORD);
debug_printf(TEXT("Dlg: class=%04x\n"), *(WORD*)mem);
mem += sizeof(WORD);
} else
if (*(WORD*)mem == 0x0000) {
/* default class */
mem += sizeof(WORD);
debug_printf(TEXT("Dlg: class=none\n"));
} else {
/* class name */
debug_printf(TEXT("Dlg: class=%s\n"), (TCHAR*)mem);
while (*(WORD*)mem) { /* zero terminated */
mem += sizeof(WORD);
}
mem += sizeof(WORD);
}
/*
* window title
*/
debug_printf(TEXT("Dlg: title=%s\n"), (TCHAR*)mem);
while (*(WORD*)mem) { /* zero terminated */
mem += sizeof(WORD);
}
mem += sizeof(WORD);
if (dlg.style & DS_SETFONT) {
/* font size */
debug_printf(TEXT("Dlg: font size=%d\n"), *(WORD*)mem);
mem += sizeof(WORD);
/* font name */
debug_printf(TEXT("Dlg: font name=%s ("), (TCHAR*)mem);
while (*(WORD*)mem) { /* zero terminated */
debug_printf(TEXT("%04x"), *(WORD*)mem);
mem += sizeof(WORD);
}
debug_printf(TEXT(")\n"));
mem += sizeof(WORD);
}
/*
* for each control
*/
for (i = 0; i < dlg.cdit; i++) {
TCHAR *class_name = NULL;
//.........这里部分代码省略.........
开发者ID:krytarowski,项目名称:netbsd-current-src-sys,代码行数:101,代码来源:layout.c
示例9: DlgProc
BOOL APIENTRY GuiDlgAbout::DlgProc(HWND hwndDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
#ifdef DEBUG
//printf("GuiDlgAbout::DlgProc(): Message 0x%08X received.\n",message);
#endif
BYTE *logo = (BYTE *)LockResource(LoadResource(myInstance,FindResource(myInstance,MAKEINTRESOURCE(IDB_LOGO),RT_BITMAP)));
char *license = (char *)LockResource(LoadResource(myInstance,FindResource(myInstance,MAKEINTRESOURCE(IDR_TEXT_LICENSE),"TEXT")));
char *history = (char *)LockResource(LoadResource(myInstance,FindResource(myInstance,MAKEINTRESOURCE(IDR_TEXT_HISTORY),"TEXT")));
TCITEM tci;
switch (message)
{
case WM_INITDIALOG:
tab_hwnd = NULL;
// init tab control
tci.mask = TCIF_TEXT;
tci.pszText = " General ";
SendDlgItemMessage(hwndDlg,IDC_ATABS,TCM_INSERTITEM,0,(LPARAM)&tci);
tci.pszText = " License ";
SendDlgItemMessage(hwndDlg,IDC_ATABS,TCM_INSERTITEM,1,(LPARAM)&tci);
tci.pszText = " What's New ";
SendDlgItemMessage(hwndDlg,IDC_ATABS,TCM_INSERTITEM,2,(LPARAM)&tci);
// set default tab index
SendDlgItemMessage(hwndDlg,IDC_ATABS,TCM_SETCURSEL,0,0);
case WM_SYSCOLORCHANGE:
case WM_UPDATE:
// delete old tab window
if (tab_hwnd)
{
DestroyWindow(tab_hwnd);
tab_hwnd = NULL;
}
// display new tab window
tab_index = (int)SendDlgItemMessage(hwndDlg,IDC_ATABS,TCM_GETCURSEL,0,0);
switch (tab_index)
{
case 0:
// fix logo
*(DWORD *)&logo[0x28 + (logo[0x428] << 2)] = REVERSE(GetSysColor(COLOR_BTNFACE));
tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_ABT_ADPLUG),GetDlgItem(hwndDlg,IDC_ATABWND),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
// plugin
SetDlgItemText(tab_hwnd,IDC_PLUGIN_VER,PLUGIN_VER " (" __DATE__ /*" " __TIME__ */")");
break;
case 1:
tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_ABT_LICENSE),GetDlgItem(hwndDlg,IDC_ATABWND),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
// license
SetDlgItemText(tab_hwnd,IDC_LICENSE,license);
break;
case 2:
tab_hwnd = CreateDialogParam(myInstance,MAKEINTRESOURCE(IDD_ABT_HISTORY),GetDlgItem(hwndDlg,IDC_ATABWND),(DLGPROC)TabDlgProc_Wrapper,(LPARAM)this);
// history
SetDlgItemText(tab_hwnd,IDC_HISTORY,history);
break;
}
return FALSE;
case WM_NOTIFY:
switch (((NMHDR *)lParam)->code)
{
case TCN_SELCHANGE:
PostMessage(hwndDlg,WM_UPDATE,0,0);
return FALSE;
}
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDCANCEL:
EndDialog(hwndDlg,wParam);
return 0;
}
}
//.........这里部分代码省略.........
开发者ID:adplug,项目名称:winamp,代码行数:101,代码来源:dlg_about.cpp
示例10:
/// \brief
/// Create or return an existing prefab type with the passed filename.
inline VPrefab *LoadPrefab(const char *szFilename) {return (VPrefab *)LoadResource(szFilename);}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:3,代码来源:VPrefab.hpp
示例11: wxT
dlgSearchObject::dlgSearchObject(frmMain *p, pgDatabase *db)
{
parent = p;
header = wxT("");
currentdb = db;
wxWindowBase::SetFont(settings->GetSystemFont());
LoadResource(p, wxT("dlgSearchObject"));
// Icon
appearanceFactory->SetIcons(this);
RestorePosition();
btnSearch->Disable();
lcResults->InsertColumn(0, _("Type"));
lcResults->InsertColumn(1, _("Name"));
lcResults->InsertColumn(2, _("Path"));
// Mapping table between local language and english,
// because in SQL we're using only english and translate it later
// to the local language.
aMap[_("All types")] = wxT("All types");
aMap[_("Schemas")] = wxT("Schemas");
aMap[_("Tables")] = wxT("Tables");
aMap[_("Columns")] = wxT("Columns");
aMap[_("Triggers")] = wxT("Triggers");
aMap[_("Views")] = wxT("Views");
aMap[_("Rules")] = wxT("Rules");
aMap[_("Indexes")] = wxT("Indexes");
aMap[_("Functions")] = wxT("Functions");
aMap[_("Aggregates")] = wxT("Aggregates");
aMap[_("Trigger Functions")] = wxT("Trigger Functions");
aMap[_("Constraints")] = wxT("Constraints");
aMap[_("Sequences")] = wxT("Sequences");
aMap[_("Types")] = wxT("Types");
aMap[_("Domains")] = wxT("Domains");
aMap[_("Languages")] = wxT("Languages");
aMap[_("Conversions")] = wxT("Conversions");
aMap[_("Casts")] = wxT("Casts");
aMap[_("Login Roles")] = wxT("Login Roles");
aMap[_("Group Roles")] = wxT("Group Roles");
aMap[_("FTS Configurations")] = wxT("FTS Configurations");
aMap[_("FTS Dictionaries")] = wxT("FTS Dictionaries");
aMap[_("FTS Parsers")] = wxT("FTS Parsers");
aMap[_("FTS Templates")] = wxT("FTS Templates");
aMap[_("Foreign Data Wrappers")] = wxT("Foreign Data Wrappers");
aMap[_("Foreign Servers")] = wxT("Foreign Servers");
aMap[_("Foreign Tables")] = wxT("Foreign Tables");
aMap[_("User Mappings")] = wxT("User Mappings");
aMap[_("Operators")] = wxT("Operators");
aMap[_("Operator Classes")] = wxT("Operator Classes");
aMap[_("Operator Families")] = wxT("Operator Families");
aMap[_("Extensions")] = wxT("Extensions");
aMap[_("Collations")] = wxT("Collations");
cbType->Clear();
cbType->Append(_("All types"));
cbType->Append(_("Schemas"));
cbType->Append(_("Tables"));
cbType->Append(_("Columns"));
cbType->Append(_("Triggers"));
cbType->Append(_("Views"));
cbType->Append(_("Rules"));
cbType->Append(_("Indexes"));
cbType->Append(_("Functions"));
cbType->Append(_("Aggregates"));
cbType->Append(_("Trigger Functions"));
cbType->Append(_("Constraints"));
cbType->Append(_("Sequences"));
cbType->Append(_("Types"));
cbType->Append(_("Languages"));
cbType->Append(_("Domains"));
cbType->Append(_("Conversions"));
cbType->Append(_("Casts"));
cbType->Append(_("Login Roles"));
cbType->Append(_("Group Roles"));
cbType->Append(_("FTS Configurations"));
cbType->Append(_("FTS Dictionaries"));
cbType->Append(_("FTS Parsers"));
cbType->Append(_("FTS Templates"));
if(currentdb->BackendMinimumVersion(8, 4))
{
cbType->Append(_("Foreign Data Wrappers"));
cbType->Append(_("Foreign Servers"));
cbType->Append(_("User Mappings"));
}
if(currentdb->BackendMinimumVersion(9, 1))
{
cbType->Append(_("Foreign Tables"));
}
cbType->Append(_("Operators"));
cbType->Append(_("Operator Classes"));
cbType->Append(_("Operator Families"));
if(currentdb->BackendMinimumVersion(9, 1))
{
cbType->Append(_("Extensions"));
cbType->Append(_("Collations"));
//.........这里部分代码省略.........
开发者ID:aiht,项目名称:pgadmin3,代码行数:101,代码来源:dlgSearchObject.cpp
示例12: LoadImageFromResources
HBITMAP LoadImageFromResources(
_In_ UINT Width,
_In_ UINT Height,
_In_ PCWSTR Name
)
{
UINT width = 0;
UINT height = 0;
UINT frameCount = 0;
BOOLEAN isSuccess = FALSE;
ULONG resourceLength = 0;
HGLOBAL resourceHandle = NULL;
HRSRC resourceHandleSource = NULL;
WICInProcPointer resourceBuffer = NULL;
BITMAPINFO bitmapInfo = { 0 };
HBITMAP bitmapHandle = NULL;
PBYTE bitmapBuffer = NULL;
IWICStream* wicStream = NULL;
IWICBitmapSource* wicBitmapSource = NULL;
IWICBitmapDecoder* wicDecoder = NULL;
IWICBitmapFrameDecode* wicFrame = NULL;
IWICImagingFactory* wicFactory = NULL;
IWICBitmapScaler* wicScaler = NULL;
WICPixelFormatGUID pixelFormat;
WICRect rect = { 0, 0, Width, Height };
__try
{
// Create the ImagingFactory
if (FAILED(CoCreateInstance(&CLSID_WICImagingFactory1, NULL, CLSCTX_INPROC_SERVER, &IID_IWICImagingFactory, &wicFactory)))
__leave;
// Find the resource
if ((resourceHandleSource = FindResource(PluginInstance->DllBase, Name, L"PNG")) == NULL)
__leave;
// Get the resource length
resourceLength = SizeofResource(PluginInstance->DllBase, resourceHandleSource);
// Load the resource
if ((resourceHandle = LoadResource(PluginInstance->DllBase, resourceHandleSource)) == NULL)
__leave;
if ((resourceBuffer = (WICInProcPointer)LockResource(resourceHandle)) == NULL)
__leave;
// Create the Stream
if (FAILED(IWICImagingFactory_CreateStream(wicFactory, &wicStream)))
__leave;
// Initialize the Stream from Memory
if (FAILED(IWICStream_InitializeFromMemory(wicStream, resourceBuffer, resourceLength)))
__leave;
if (FAILED(IWICImagingFactory_CreateDecoder(wicFactory, &GUID_ContainerFormatPng, NULL, &wicDecoder)))
__leave;
if (FAILED(IWICBitmapDecoder_Initialize(wicDecoder, (IStream*)wicStream, WICDecodeMetadataCacheOnLoad)))
__leave;
// Get the Frame count
if (FAILED(IWICBitmapDecoder_GetFrameCount(wicDecoder, &frameCount)) || frameCount < 1)
__leave;
// Get the Frame
if (FAILED(IWICBitmapDecoder_GetFrame(wicDecoder, 0, &wicFrame)))
__leave;
// Get the WicFrame image format
if (FAILED(IWICBitmapFrameDecode_GetPixelFormat(wicFrame, &pixelFormat)))
__leave;
// Check if the image format is supported:
if (IsEqualGUID(&pixelFormat, &GUID_WICPixelFormat32bppPBGRA)) // GUID_WICPixelFormat32bppRGB
{
wicBitmapSource = (IWICBitmapSource*)wicFrame;
}
else
{
// Convert the image to the correct format:
if (FAILED(WICConvertBitmapSource(&GUID_WICPixelFormat32bppPBGRA, (IWICBitmapSource*)wicFrame, &wicBitmapSource)))
__leave;
IWICBitmapFrameDecode_Release(wicFrame);
}
bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bitmapInfo.bmiHeader.biWidth = rect.Width;
bitmapInfo.bmiHeader.biHeight = -((LONG)rect.Height);
bitmapInfo.bmiHeader.biPlanes = 1;
bitmapInfo.bmiHeader.biBitCount = 32;
bitmapInfo.bmiHeader.biCompression = BI_RGB;
HDC hdc = CreateCompatibleDC(NULL);
bitmapHandle = CreateDIBSection(hdc, &bitmapInfo, DIB_RGB_COLORS, (PVOID*)&bitmapBuffer, NULL, 0);
ReleaseDC(NULL, hdc);
//.........这里部分代码省略.........
开发者ID:chosen1,项目名称:ProcessHacker,代码行数:101,代码来源:searchbox.c
示例13: test_initial_focus
static void test_initial_focus(void)
{
/* Test 1:
* This test intentionally returns FALSE in response to WM_INITDIALOG
* without setting focus to a control. This is not allowed according to
* MSDN, but it is exactly what MFC's CFormView does.
*
* Since the WM_INITDIALOG handler returns FALSE without setting the focus,
* the focus should initially be NULL. Later, when we manually set focus to
* the dialog, the default handler should set focus to the first control that
* is "visible, not disabled, and has the WS_TABSTOP style" (MSDN). Because the
* second radio button has been checked, it should be the first control
* that meets these criteria and should receive the focus.
*/
g_bInitialFocusInitDlgResult = FALSE;
g_hwndInitialFocusT1 = (HWND) -1;
g_hwndInitialFocusT2 = (HWND) -1;
g_styleInitialFocusT1 = -1;
g_styleInitialFocusT2 = -1;
DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
ok (((g_styleInitialFocusT1 & WS_TABSTOP) == 0),
"Error in wrc - Detected WS_TABSTOP as default style for GROUPBOX\n");
ok (((g_styleInitialFocusT2 & WS_VISIBLE) == 0),
"Modal dialogs should not be shown until the message queue first goes empty\n");
ok ((g_hwndInitialFocusT1 == NULL),
"Error in initial focus when WM_INITDIALOG returned FALSE: "
"Expected NULL focus, got %s (%p).\n",
GetHwndString(g_hwndInitialFocusT1), g_hwndInitialFocusT1);
ok ((g_hwndInitialFocusT2 == g_hwndButton2),
"Error after first SetFocus() when WM_INITDIALOG returned FALSE: "
"Expected the second button (%p), got %s (%p).\n",
g_hwndButton2, GetHwndString(g_hwndInitialFocusT2),
g_hwndInitialFocusT2);
/* Test 2:
* This is the same as above, except WM_INITDIALOG is made to return TRUE.
* This should cause the focus to go to the second radio button right away
* and stay there (until the user indicates otherwise).
*/
g_bInitialFocusInitDlgResult = TRUE;
g_hwndInitialFocusT1 = (HWND) -1;
g_hwndInitialFocusT2 = (HWND) -1;
g_styleInitialFocusT1 = -1;
g_styleInitialFocusT2 = -1;
DialogBoxA(g_hinst, "RADIO_TEST_DIALOG", NULL, delayFocusDlgWinProc);
ok ((g_hwndInitialFocusT1 == g_hwndButton2),
"Error in initial focus when WM_INITDIALOG returned TRUE: "
"Expected the second button (%p), got %s (%p).\n",
g_hwndButton2, GetHwndString(g_hwndInitialFocusT1),
g_hwndInitialFocusT1);
ok ((g_hwndInitialFocusT2 == g_hwndButton2),
"Error after first SetFocus() when WM_INITDIALOG returned TRUE: "
"Expected the second button (%p), got %s (%p).\n",
g_hwndButton2, GetHwndString(g_hwndInitialFocusT2),
g_hwndInitialFocusT2);
/* Test 3:
* If the dialog has DS_CONTROL and it's not visible then we shouldn't change focus */
{
HWND hDlg;
HRSRC hResource;
HANDLE hTemplate;
DLGTEMPLATE* pTemplate;
hResource = FindResourceA(g_hinst,"FOCUS_TEST_DIALOG", RT_DIALOG);
hTemplate = LoadResource(g_hinst, hResource);
pTemplate = LockResource(hTemplate);
g_hwndInitialFocusT1 = 0;
hDlg = CreateDialogIndirectParamA(g_hinst, pTemplate, NULL, focusDlgWinProc, 0);
ok (hDlg != 0, "Failed to create test dialog.\n");
ok ((g_hwndInitialFocusT1 == 0),
"Focus should not be set for an invisible DS_CONTROL dialog %p.\n", g_hwndInitialFocusT1);
DestroyWindow(hDlg);
}
}
开发者ID:MichaelMcDonnell,项目名称:wine,代码行数:88,代码来源:dialog.c
示例14: SetIcon
/*!
@brief このメソッドは WM_INITDIALOG のメッセージに応答して呼び出されます。
*/
BOOL CInspectUsefulToolsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// このダイアログのアイコンを設定します。アプリケーションのメイン ウィンドウがダイアログでない場合、
// Framework は、この設定を自動的に行います。
SetIcon(m_hIcon, TRUE); // 大きいアイコンの設定
//SetIcon(m_hIcon, FALSE); // 小さいアイコンの設定
// メニューの初期化
InitializeMenuTree();
InitializeContents();
// タイトルの設定
CString strAppName = CString((LPCTSTR)IDS_APP_NAME);
this->SetWindowText(strAppName);
CLSID clsid;
if (CLSIDFromProgID(OLESTR("Excel.Application"), &clsid) == NOERROR){
// Excel がインストールされている
LPUNKNOWN lpUnk;
HRESULT hr;
LPDISPATCH lpDispatch;
BOOL bOpenExcel = FALSE;
if (GetActiveObject(clsid, NULL, &lpUnk) == NOERROR){
hr = lpUnk->QueryInterface(IID_IDispatch, (LPVOID*)&lpDispatch);
lpUnk->Release();
if (hr == NOERROR) {
//すでにExcelが起動されている状態であればAttachDispatch
m_inXLApp.AttachDispatch(lpDispatch,TRUE);
bOpenExcel = TRUE;
}
}
if (m_inXLApp.m_lpDispatch == NULL) {
bOpenExcel = m_inXLApp.CreateDispatch(clsid);
m_bOpenXL = TRUE;
}
if (bOpenExcel == TRUE) {
// Excelファイルの初期化
CWorkbooks inWorkbooks = m_inXLApp.get_Workbooks();
COleVariant varNull;
varNull.ChangeType(VT_NULL);
HRSRC hrSrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_MACRO_EXCEL_RCDATA), RT_RCDATA);
if (hrSrc != NULL) {
HGLOBAL hGlobal = LoadResource(AfxGetApp()->m_hInstance, hrSrc);
if (hGlobal != NULL) {
char *rcData = (char *)LockResource(hGlobal);
/* リソースサイズの取得 */
DWORD dwSize = SizeofResource(AfxGetApp()->m_hInstance, hrSrc);
TCHAR szFilePath[MAX_PATH];
GetTempPath(MAX_PATH, szFilePath);
TCHAR szFileName[MAX_PATH];
GetTempFileName(szFilePath, _T("SubTools_"), 0, szFileName);
CFile inFile;
inFile.Open(szFileName, CFile::modeWrite);
inFile.Write(rcData, dwSize);
inFile.Close();
strTempFilePath = szFileName;
m_inXLBook = inWorkbooks.Open(szFileName
, varNull, varNull, varNull, varNull, varNull, varNull, varNull, varNull, varNull, varNull, varNull, varNull,varNull, varNull);
m_bOpenBook = TRUE;
}
}
}
}
return TRUE;
}
开发者ID:todesmarz,项目名称:InspectUsefulTools,代码行数:79,代码来源:InspectUsefulToolsDlg.cpp
示例15: MAKEINTRESOURCE
CSize CPopupWnd::GetContentDlgSize( CDialog* pDlg, UINT nID )
{
CSize sizeDlg;
typedef struct {
WORD dlgVer;
WORD signature;
DWORD helpID;
DWORD exStyle;
DWORD style;
WORD cDlgItems;
short x;
short y;
short cx;
short cy;
// 后面的属性不能直接用,要根据具体的情况分析,是变长结构
// ...
} DLGTEMPLATEEX;
//
LPCTSTR lpszName = MAKEINTRESOURCE( nID );
HINSTANCE hInstance = AfxFindResourceHandle( lpszName, RT_DIALOG );
HRSRC hResource = ::FindResource( hInstance, lpszName, RT_DIALOG );
HGLOBAL hTemplate = LoadResource( hInstance, hResource);
DLGTEMPLATE* pTemplate;
WORD *pDlgTemplateTemp = NULL;
int nPageWidth = 0;
int nPageHeight = 0;
pTemplate = (DLGTEMPLATE*)(LPCDLGTEMPLATE)LockResource(hTemplate);
// 判断是哪一种 dlg 模板
pDlgTemplateTemp = (WORD*)pTemplate;
if ( pDlgTemplateTemp[1] == 0xFFFF )
{
// 扩展模板
DLGTEMPLATEEX *pTemplateEx = (DLGTEMPLATEEX*)pTemplate;
nPageWidth = pTemplateEx->cx;
nPageHeight = pTemplateEx->cy;
}
else
{
nPageWidth = pTemplate->cx;
nPageHeight = pTemplate->cy;
}
//
UnlockResource(hTemplate);
// dialog模板使用的是 dialog unit, 需要转换成 pixel unit
CRect rectTemp( 0, 0, nPageWidth, nPageHeight);
::MapDialogRect( pDlg->GetSafeHwnd(), &rectTemp );
sizeDlg.cx = rectTemp.Width();
sizeDlg.cy = rectTemp.Height();
//
return sizeDlg;
}
开发者ID:tianyx,项目名称:TxUIProject,代码行数:61,代码来源:PopupWnd.cpp
示例16: DEBUG
ResourceManager::ResourceManager(std::string category, int propsId, int jarId, int jniId)
{
m_resourceCategory = category;
m_resourcePropsId = propsId;
m_resourceJarId = jarId;
//
// Load the Properties
//
DEBUG("Initialize properties...");
std::string propsidstr = this->idToResourceName(propsId);
HRSRC resprop = FindResource(NULL, propsidstr.c_str(), category.c_str());
if (resprop != NULL)
{
int mainsize = 0;
mainsize = SizeofResource(NULL, resprop);
// char mainbuf[mainsize+1];
HGLOBAL main = LoadResource(NULL, resprop);
m_props.setData((const char*)main, mainsize);
}
else
{
m_lastError = "Can't find resource 'main name'";
return;
}
//
// Split the arguments
//
m_arguments = StringUtils::split(getProperty(KEY_ARGUMENTS, ""), " \t\n\r", "\"\'");
//
// loads the jar information
//
std::string jaridstr = this->idToResourceName(jarId);
HRSRC resjar = FindResource(NULL, jaridstr.c_str(), category.c_str());
if (resjar != NULL)
{
m_jarSize = SizeofResource(NULL, resjar);
m_jarHandler = LoadResource(NULL, resjar);
}
else
{
m_lastError = "Can't find JAR resource!";
return;
}
m_jnismoothSize = this->getResourceSize(jniId);
m_jnismoothHandler = this->getResource(jniId);
//
// Extract the java properties from the Property
//
std::string jpropcountstr = m_props.get("javapropertiescount");
string exepath = FileUtils::getExecutablePath();
string exename = FileUtils::getExecutableFileName();
string computername = FileUtils::getComputerName();
int jpropcount = StringUtils::parseInt(jpropcountstr);
DEBUG("Number of Java Parameters: "+jpropcountstr);
for (int i=0; i<jpropcount; i++)
{
string namekey = string("javaproperty_name_") + StringUtils::toString(i);
string valuekey = string("javaproperty_value_") + StringUtils::toString(i);
string name = m_props.get(namekey);
string value = m_props.get(valuekey);
DEBUG("Setting up java properties SOURCE: " + name + "=" + value + " : property if exist: " +getProperty(name,"&qu
|
请发表评论