|
Hi All,
Can someone tell me how to identify the font used by Windows Explorer when showing file names? Is it somewhere in the registry?
Thanks,
Chris
|
|
|
|
|
I belive it lives at:
HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\IconFont
Though if I remeber correctly it's a pain as it's stored as a REG_BINARY along with some extra info.
See
http://perso.wanadoo.fr/tmcd2/Shell.htm#IconFont
|
|
|
|
|
Hi Diddy,
Its ok I found the following... Thanks anyway..
Chris
SystemParametersInfo(SPI_GETICONTITLELOGFONT, uifnt, &fnt, 0);
|
|
|
|
|
Hi,
I am trying to get the error description for the error 12045 using the following code, but it doesnt work and gives me error 317. Any ideas how to get this working?
if (!FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error_code,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
pMsgBuf,
4*1024,
NULL ))
Thanks,
Sigma
|
|
|
|
|
Well I am using the following code. This checks for error messages of networks too
<br />
LPVOID lpMsgBuf;
<br />
DWORD dwRet = ::FormatMessage( <br />
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER,<br />
NULL, <br />
iErrCode,<br />
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),<br />
(LPTSTR) &lpMsgBuf,<br />
0,<br />
NULL);<br />
<br />
if (dwRet == 0)
{
HMODULE hDll = ::LoadLibraryEx( TEXT("netmsg.dll"), NULL, <br />
DONT_RESOLVE_DLL_REFERENCES );<br />
{<br />
if (hDll != NULL)<br />
{<br />
dwRet = FormatMessage(<br />
FORMAT_MESSAGE_FROM_HMODULE | FORMAT_MESSAGE_FROM_SYSTEM,<br />
hDll,<br />
iErrCode,<br />
MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US),<br />
(LPTSTR) &lpMsgBuf,<br />
0,<br />
NULL);<br />
::FreeLibrary(hDll);<br />
}<br />
}<br />
}<br />
<br />
if ( m_pszErrMessage!=NULL )<br />
{<br />
delete []m_pszErrMessage;<br />
m_pszErrMessage = NULL;<br />
}<br />
<br />
if (lpMsgBuf != NULL)<br />
{<br />
m_pszErrMessage = new TCHAR[dwRet+1];<br />
::strcpy( m_pszErrMessage, (TCHAR*)lpMsgBuf );<br />
m_pszErrMessage[dwRet-2 ] = 0;<br />
::LocalFree( lpMsgBuf );<br />
}<br />
else<br />
{<br />
m_pszErrMessage = new TCHAR[<br />
strlen("Unknown error in evaluating Error Code")+1];<br />
<br />
::strcpy(m_pszErrMessage, "Unknown error in evaluating Error Code");<br />
}<br />
|
|
|
|
|
The error code 12045 may not belong to system message-table. You have to know where error occur and look up error from that module.
Here is the code except from MSDN. Hope useful to you
<br />
HMODULE hModule = NULL;
LPSTR MessageBuffer;<br />
DWORD dwBufferLength;<br />
<br />
DWORD dwFormatFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER |<br />
FORMAT_MESSAGE_IGNORE_INSERTS |<br />
FORMAT_MESSAGE_FROM_SYSTEM ;<br />
<br />
<br />
if(dwLastError >= NERR_BASE && dwLastError <= MAX_NERR){<br />
hModule = LoadLibraryEx(TEXT("netmsg.dll"), NULL, LOAD_LIBRARY_AS_DATAFILE);<br />
<br />
if(hModule != NULL)<br />
dwFormatFlags |= FORMAT_MESSAGE_FROM_HMODULE;<br />
}<br />
<br />
<br />
if(dwBufferLength = FormatMessageA(<br />
dwFormatFlags,<br />
hModule,
dwLastError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) &MessageBuffer,<br />
0,<br />
NULL<br />
))<br />
{<br />
DWORD dwBytesWritten;<br />
<br />
WriteFile(<br />
GetStdHandle(STD_ERROR_HANDLE),<br />
MessageBuffer,<br />
dwBufferLength,<br />
&dwBytesWritten,<br />
NULL<br />
);<br />
<br />
LocalFree(MessageBuffer);<br />
}<br />
<br />
if(hModule != NULL)<br />
FreeLibrary(hModule);<br />
|
|
|
|
|
Is netmsg.dll commonly available on all windows versions? (98, nt, 2k, xp)
|
|
|
|
|
netmsg.dll is a Network Management module. It is an example only. In your case, error message can find in another module, depend on the context.
|
|
|
|
|
Yes, 12045 doesnt fall between NERR_BASE(2100) and MAX_NERR(2999).
So any idea which module (dll) should I load for 12045?
Thanks
|
|
|
|
|
Can anyone tell me under what conditions will CreateProcessWithLogonW return "Access is Denied" error. It is running on some computers and giving the error on some computers.
Thanks in advance.
|
|
|
|
|
At a guess, I'd say that the user you're trying to log on doesn't have file-system permission to execute the file you've specified. Check this.
The documentation indicates, for XP and 2003: "CreateProcessWithLogonW accesses the specified directory and executable image in the security context of the target user" and goes on to talk about network drives.
You should also check that the RunAs service is started, on Windows 2000. On Windows XP and 2003, the service is called Secondary Logon.
Also, the documentation states: "The user account must have the Log On Locally permission on the local computer. This permission is granted to all users on workstations and servers, but only to administrators on domain controllers."
A bit of Googling has also revealed that you might need to set the lpDesktop member of lpStartupInfo to Winsta0\Desktop.
Is there any pattern to which computers it works/doesn't work on, with respect to OS and Service Pack level?
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi all,
I'm about to start writing an interface to a webcam and have decided to go the DirectShow route, my question is does anyone know of any good tutorial websites which cover this (I've tried searching for some but they all seem to jump into the deepend straight away), or is it going to be a case of going through other peoples code and trying to figure out what thye are doing?
btw I've never done any DirectX programming before.
many TIA,
Andy
|
|
|
|
|
download the directX sdk from microsoft.
in \\Dx8VcSdk\samples\multimedia\directshow\capture\amcap
you fill find an example, of how to capture all videoinputs
there are more good examples in the sdk
|
|
|
|
|
i need to do some research work on cryptography and ultimately write code to protect the commercial programs that i write to to have some sort of license protection. Any help regarding this will be greatly appreciated.
Thanks
|
|
|
|
|
As my opinion, there are no way can protect your software absolutely. Hackers can decompile any software and with the helping from few debugers, they can trace that code and break down the protection.
So, I think you should concentrate in writing your application as perfect as posible. You can use some protection mechanisms such as: hard disk serial number, hard disk manufature serial number, network card MAC, user information...With a hashing algorithm, you will create yourself software serial number which must be matched to run.
Because infact there are no perfect way, articles about that problem are controversial topics. In codeproject, you can find few such article.
|
|
|
|
|
Best and easier way to protect is having an USB or paralel port security key...
They are easy to implement and very secure, expecially if you make your code dynamically dependent on the existence of that key.
Price: affordable for most commercial applications. If the application is to be used for a lot of computers in a domain, there are special keys that validate the application through the network.
Software-based security is allways possible to crack, except in some very special cases.
|
|
|
|
|
|
thanks for the advice and the help guys...
really appreciate it...
|
|
|
|
|
Does any body know about API (hidden) for the Outlook Express to get any information within the OE. I am writing a customization patch for OE. I have just completed Toolbar and reading the current selction from message list (header part), but I could not read the messege header (actual email messaage information.
Any help
|
|
|
|
|
Hi,
I'm developping an ISAPI FILTER that whill be installed on a ISA SERVER. This ISAPI filter should handle the following action for each client which wants to connect to Internet:
1. Gets the user name and the URL of the site to which he or she wanted to navigate
2. redirect any request to an Intranet site which shows a simple Web page with some warnings and also the link to the site to which the user wanted to connect
3. the user can then click on the link and navigate wherever he/she likes
The redirection should happen at the beginning of any network session. Is it true that a network session can contain many session requests??
Where can I find some documentation/help?
You can see my actual code as follows: this code only write a log file to see what happens and try to catch the user name on the AUTH_COMPLETE notification and to catch the URL requested on the PREPROC_HEADERS notification: I'm already sure that there is a problem with getting the user name... can anybody help my?:
#include <windows.h>
#include <httpfilt.h>
#include <stdio.h>
#include <iostream>
#include <fstream>
const UINT MAX_NAME = 10;
const char sFileName[] = "c:\\temp\\AIM_FILTER_LOG.txt";
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc);
static DWORD OnPreprocHeaders (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo);
static DWORD OnReadRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData);
static DWORD OnAuthComplete (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_AUTH_COMPLETE_INFO pAuthCompInfo);
static DWORD OnSendResponse (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_SEND_RESPONSE pResponse);
static DWORD OnSendRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData);
static DWORD OnEndOfRequest (PHTTP_FILTER_CONTEXT pfc);
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc);
static DWORD WriteIntoFile(PHTTP_FILTER_CONTEXT pfc, const char *Testo);
BOOL WINAPI TerminateFilter(
DWORD dwFlags
)
{
return TRUE;
}
BOOL WINAPI GetFilterVersion(PHTTP_FILTER_VERSION pVer)
{
pVer->dwFilterVersion = HTTP_FILTER_REVISION;
pVer->dwFlags = SF_NOTIFY_ORDER_HIGH | SF_NOTIFY_SECURE_PORT | SF_NOTIFY_NONSECURE_PORT
| SF_NOTIFY_PREPROC_HEADERS | SF_NOTIFY_READ_RAW_DATA | SF_NOTIFY_AUTH_COMPLETE |
SF_NOTIFY_SEND_RESPONSE | SF_NOTIFY_SEND_RAW_DATA |
SF_NOTIFY_END_OF_REQUEST | SF_NOTIFY_END_OF_NET_SESSION;
return TRUE;
}
DWORD WINAPI HttpFilterProc(
PHTTP_FILTER_CONTEXT pfc,
DWORD NotificationType,
LPVOID pvNotification
)
{
DWORD dwRet = SF_STATUS_REQ_NEXT_NOTIFICATION;
switch (NotificationType)
{
case SF_NOTIFY_READ_RAW_DATA:
dwRet = OnReadRawData(pfc, (PHTTP_FILTER_RAW_DATA) pvNotification);
break;
case SF_NOTIFY_PREPROC_HEADERS:
dwRet = OnPreprocHeaders(pfc, (PHTTP_FILTER_PREPROC_HEADERS) pvNotification);
break;
case SF_NOTIFY_AUTH_COMPLETE:
dwRet = OnAuthComplete(pfc, (PHTTP_FILTER_AUTH_COMPLETE_INFO)pvNotification);
break;
case SF_NOTIFY_SEND_RESPONSE:
dwRet = OnSendResponse(pfc, (PHTTP_FILTER_SEND_RESPONSE)pvNotification);
break;
case SF_NOTIFY_SEND_RAW_DATA:
dwRet = OnSendRawData(pfc, (PHTTP_FILTER_RAW_DATA)pvNotification);
break;
case SF_NOTIFY_END_OF_REQUEST:
dwRet = OnEndOfRequest(pfc);
break;
case SF_NOTIFY_END_OF_NET_SESSION:
dwRet = OnEndOfNetSession(pfc);
break;
default:
// We cannot reach here, unless Web Filter support has a BAD ERROR.
dwRet = SF_STATUS_REQ_ERROR;
break;
};
return dwRet;
}
/*
* OnAuthComplete():
*/
static DWORD OnAuthComplete(PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_AUTH_COMPLETE_INFO pAuthCompInfo)
{
HANDLE TokenHandle = (HANDLE)1;
DWORD dwLen = 0;
PTOKEN_USER pTokenUser = NULL;
DWORD dwErr;
char name[MAX_NAME], domain[MAX_NAME];
// Get user token.
if ( pAuthCompInfo->GetUserToken(pfc,&TokenHandle) )
{
// Get token information size.
if ( !GetTokenInformation(TokenHandle,TokenUser,NULL,dwLen,&dwLen) )
{
dwErr = GetLastError();
if ( ERROR_INSUFFICIENT_BUFFER == dwErr )
{
// Alocate buffer for token information.
pTokenUser = (PTOKEN_USER)GlobalAlloc(GPTR,dwLen);
dwErr = S_OK;
}
}
// Now get the actual token information.
if ( dwErr != S_OK ||
!GetTokenInformation(TokenHandle, TokenUser,pTokenUser,dwLen,&dwLen) )
{
// Error …
}
else // We have the token information in hand.
{
// Extract from the token information - the SID.
SID *pSid = (SID *)pTokenUser->User.Sid;
DWORD dwNLen = MAX_NAME, dwDLen = MAX_NAME;
SID_NAME_USE eUse;
// Get the user name and the domain from the SID.
if (!LookupAccountSid(NULL,pSid,name,&dwNLen,domain,&dwDLen,&eUse) )
{
// Error …
}
else
{
// name buffer contains user name.
// domain buffer contains user domain.
}
}
}
if (*name != NULL)
return WriteIntoFile(pfc, "Evento OnAuthComplete: User name:" + *name);
else
return WriteIntoFile(pfc, "Evento OnAuthComplete: ");
return WriteIntoFile(pfc, "Evento OnAuthComplete: ");
}
static DWORD OnPreprocHeaders (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_PREPROC_HEADERS pHeaderInfo)
{
char buffer[256];
DWORD buffSize = sizeof(buffer);
BOOL bHeader = pHeaderInfo->GetHeader(pfc, "url", buffer, &buffSize);
//scrive URL nel file
return WriteIntoFile(pfc, "Evento OnPreprocHeaders " + *buffer);
}
/*
* OnReadRawData():
*/
static DWORD OnReadRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pRawData)
{
return WriteIntoFile(pfc, "Evento OnReadRawData: ");
}
/*
* OnSendResponse():
*/
static DWORD OnSendResponse (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_SEND_RESPONSE pResponse)
{
return WriteIntoFile(pfc, "Evento OnSendResponse: ");
}
/*
* OnSendRawData():
*/
static DWORD OnSendRawData (PHTTP_FILTER_CONTEXT pfc, PHTTP_FILTER_RAW_DATA pInRawData)
{
return WriteIntoFile(pfc, "Evento OnSendRawData: ");
}
/*
* OnEndOfNetSession():
*/
static DWORD OnEndOfNetSession (PHTTP_FILTER_CONTEXT pfc)
{
return WriteIntoFile(pfc, "Evento OnEndOfNetSession: ");
}
/*
* OnEndOfRequest():
*/
static DWORD OnEndOfRequest (PHTTP_FILTER_CONTEXT pfc)
{
return WriteIntoFile(pfc, "Evento OnEndOfRequest: ");
}
/*
* WriteIntoFile()
*
*/
static DWORD WriteIntoFile(PHTTP_FILTER_CONTEXT pfc, const char *Testo)
{
std::ofstream myFile;
myFile.open(sFileName,std::ios::app);
if(myFile.is_open())
{
myFile << Testo;
myFile << "\n\n";
//myFile.write(Testo,strlen(Testo));
//myFile.flush();
}
else
{
char myString[] = "Write File Error \n ";
strcat(myString, Testo);
LPBYTE lpBuffer = (LPBYTE)&myString;
DWORD bytesToSend = sizeof myString;
DWORD dwReserved = 0;
pfc->WriteClient(pfc,(LPVOID)lpBuffer,&bytesToSend,dwReserved);
//ErrorHandler("Could not open file."); // process error
return SF_STATUS_REQ_ERROR;
}
myFile.close();
return SF_STATUS_REQ_NEXT_NOTIFICATION;
}
|
|
|
|
|
How to make callouts similar to that of in MS-Word application.
I want to add a callout feature to my project.What i have did is created a dynamic textbox and tracker to resize the text. Now i want this text to embeded in a callout which is an image. please help me.
|
|
|
|
|
Sub : How to Load/Save Image in database using VC++ MFC
Hi Guys...
Can any body help me...
I want to save image in database..but i'm not finding any sample code anywhere... can u provide me..I'll be very thankful to u...
So nice of u..
u can send attach-ment at
sumit_kapoor1980@hotmail.com
Thanks..Sumit
---Sumit Kapoor---
|
|
|
|
|
This article[^] with demo sample code.
Maxwell Chen
|
|
|
|
|
Thanks for help..Maxwell Chen
One thinge more to ask is.. How to handle other Image format..such as JPG, Tiff, Gif etc...
I think article is based on Bmp only...What do u say...let me know if u have any idea...
Thanks for last reply..
sumit
---Sumit Kapoor---
|
|
|
|
|
No idea, sorry! I am not good in image processing. But there are some articles out there in CodeProject for various image helper classes such as CPictureEx or something. The way to go would be: using different routines to handle different file types in OnSave(), and storing the image (of certain file name extension) with a specific flag in database. For example:
TABLE ImageGallery
[BLOB] - [Type] - [Size]
{...image A...}, JPEG, 258368
{...image B...}, TIFF, 8942937
Maxwell Chen
|
|
|
|
|