|
|
CodingLover wrote: Actually I fix the problem
Very good.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hi all
We have a situation with our custom TSP and an application . The TSP is a Telephony service provider which provides service to MS dialer . The issue is when the PC is restarted svchost.exe (which is active due to starting of TSP )consumes 50% CPU and another application X which commonly shares registry entries with TSP take long time . After 5 to 10 minutes the CPU load comes down and the application starts . The issues seems to be , as mentioned above , with the concurrent access of common resources (registry etc) by the TSP + application X . The worst case scenario is : Application X , as its unable to access registry , forgets the old configuration and a configuration application is started - which calls for trouble as a technician visit to site is mandatory in most cases . The point is : Application X is always part of Start menu and the TSP is started by service host as a service. I am searching for ideas to unblock this situation . Whats the best way to make svchost.exe and Application X not to fight for recources at the same time ?
1. Is its advisible to mutex lock the code surrounding the registry access ? (will it solve or worsen the situation ..!?)
2. Is there anyway we can make application X to be started only after starting of all services and other applications ? ie is there any way to prioritize the starting order of processes?
thanks
redindian
|
|
|
|
|
|
Hi
I am trying to check for the existance of the file "Microsoft.VC80.CRT.manifest" within a user defined folder
to try and find it i am using
dwResult = SearchPath(lpbPath,lpbFilename,lpbExt,dwBufferSize, szBuffer, &lpbPEnd);
where lpbFilename = "Microsoft.VC80.CRT"
and lpbExt = ".manifest"
lpbPath with be a user defined path passed to the function
however nothing is returned,i use this function to search for traditional file type (i.e something.ext) and this works fine
can anyone help at all
thanks
simon
|
|
|
|
|
Try BOOL PathFileExists(LPCTSTR pszPath);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: Try BOOL PathFileExists(LPCTSTR pszPath);
thanks
|
|
|
|
|
Hi All,
I am having huge C++/MFC project. from that multiple DLLs is creating but when i am trying to load a DLL using LoadLibrary funtion than it gives an error when it reaches on the following line
ASSERT(AfxGetThread() == NULL);
can any body please tell me why it is happaning.
thanks
Bankey
|
|
|
|
|
bankey1010 wrote:
ASSERT(AfxGetThread() == NULL);
You may get this assertion in a thread spawned with any other function than AfxBeginThread() . It's a common mistake to create threads with e.g. CreateThread() even though the MFC framework is used.
Verify that all secondary threads are created with AfxBeginThread() .
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Maybe the following note on AfxGetThread() documentation [^] would be useful
[Note] Note:
If you are porting an MFC project calling AfxGetThread from Visual C++ versions 4.2, 5.0, or 6.0, AfxGetThread calls AfxGetApp if no thread is found. In Visual C+ .NET and later, AfxGetThread returns NULL if no thread was found. If you want the application thread, you must call AfxGetApp.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi.....
I have a small problem, i have to print my part files of a CAD software to a pdf document.When i try printing to a pdf format, the resultant pdf is blank.Can someone tell me how to print data(current window image) to a pdf document using win32 sdk.Plse do help me out.
Thnx in advance.
|
|
|
|
|
raesa wrote: When i try printing to a pdf format, the resultant pdf is blank.
How are you currently creating a PDF?
raesa wrote: Can someone tell me how to print data(current window image) to a pdf document using win32 sdk.
You cannot print to a PDF with WIN32 SDK alone.
raesa wrote: Plse do help me out.
Unless you give a clue, nobody can help you out.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
FIrstly, thnx for the reply.I'll explain the problem clearly below:
I have a CAD environtment, UGNX(Unigraphicd NX) and i have a part displayed on the current opened window.I have to capure the contents of the current opened window(i.e., the image of the current opend window) of my UGNX session and put it into a PDF file.This is am trying to do, the file printing option which has PDF complete as one of the printing formats using PrintDLg function in win32 sdk.The result that i am getting is a blank pdf file.I dont seem to undertnd the problem.Can you plse have a look at my code below and tell me where i am going wrong.Plse do reply.
Thnk You.
Sample Code:
HDC GetPrinterDC(HWND hWndParent)
{
PRINTDLG pdlg;
// Initialize the PRINTDLG structure.
memset( &pdlg, 0, sizeof( PRINTDLG ) );
pdlg.lStructSize = sizeof( PRINTDLG );
DEVMODE hDevMode;
// Set the flag to return printer DC.
pdlg.Flags = PD_RETURNDEFAULT | PD_RETURNDC;
pdlg.hwndOwner = hWndParent;
DEVMODE hDmode;
PrintDlg( &pdlg );
// hDC member of the PRINTDLG structure contains
// the printer DC.
return pdlg.hDC;
}
void InitDocStruct( DOCINFO* di, char* docname)
{
// Always zero it before using it.
memset( di, 0, sizeof( DOCINFO ) );
// Fill in the required members.
di->cbSize = sizeof( DOCINFO );
di->lpszDocName = "test";
}
HINSTANCE hInstance;
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
hInstance = (HINSTANCE)hModule;
return TRUE;
}
extern "C" DllExport void ufusr( char *parm, int *returnCode, int rlen )
{
int nErr = 0;
HWND hWnd = NULL;
HDC hDC;
DOCINFO di;
nErr = UF_initialize();
if (nErr != 0)
{
uc1601 ("Failed to initialise UG session", 1);
return;
}
hWnd = GetActiveWindow();
if (hWnd != NULL)
{
hDC = GetPrinterDC(hWnd);
if( !hDC)
{
MessageBox(NULL, "Error creating DC", "Error",
MB_APPLMODAL | MB_OK );
}
InitDocStruct( &di, "Test");
StartDoc( hDC, &di );
//// Print one page.
StartPage( hDC );
//DrawStuff( hDC );
EndPage( hDC );
//// Indicate end of document.
EndDoc( hDC );
// Clean up
DeleteDC( hDC );
}
nErr = UF_terminate();
}
|
|
|
|
|
Hello ppl,
I have been trying to add Flex Grid to my MFC application in VS 2005. Actually I have added the ocx control but I cannot create it's class.
When I enter Object Browser and choose fles grid ocx and click Add Reference button it gives me an error that the ocx is not in my reference path.
How do I create it's h and cpp file of ocx and use it in my MFC application?
Thanx....
|
|
|
|
|
Seems like I have sold my problem.......
OK First we add a class to our dialog...
after that we can add a variable to our Flex Grid object.. When you do that, adding variable dialog ahs two textboxes at bottom which asks for wrapper class for ocx, you just enter the name oh .h and .cpp file, VS handles it for you..
|
|
|
|
|
Hi,
I am working on mfc and my application has chat module in which i wanat to send file through server.
I have been able to select the file to be send. I need to know what to do after I select the path of the sile to be send.
Please help me.
Thanks In Advance.
Dhiraj Kumar Ssaini
|
|
|
|
|
Open a TCP/IP connection through two users which are sender and reciever.
Sender should open the selected file in binary mode read it and write it through socket. And reciever should read incoming data from socket and write it to it's local file.
Server should be used only to connect these together. You should not send file through server, cause it costs too much and unneccesarry...
|
|
|
|
|
I got it but my requirement is such that i have to send it to the http. Is there any method through which i can achieve it like POST etc.
Thnaks
|
|
|
|
|
u can use the CHttpConnection class.
create a CInternetSession class object to create the CHttpConnection object and then use its members.
Prasann
|
|
|
|
|
Can u help me out with some code as i havent used it at all.
Thanks
|
|
|
|
|
http://www.experts-exchange.com/Programming/System/Windows__Programming/MFC/Q_20257576.html">http://www.experts-exchange.com/Programming/System/Windows__Programming/MFC/Q_20257576.html
|
|
|
|
|
All these links are paid ones and i dont have an account. Can you help me with some other links
Thanks
|
|
|
|
|
Hello everyone,
Here is my code. My code is a client application which uses WinHttp to access http://connect.microsoft.com/dashboard, I tested with IE only if valid .Net Passport account is provided, the authentication could pass, or else can not access the service.
But I tested my below code, no matter I provide valie or invalid .Net Passport account, each time 200 OK is returned. Anyone has ideas why it always returns 200 OK?
#include <windows.h>
#include <Winhttp.h>
#include <stdio.h>
#pragma comment(lib,"Winhttp.lib")
void WinHttpAuthSample()
{
DWORD dwStatusCode = 0;
DWORD dwLastStatus = 0;
DWORD dwSize = sizeof(DWORD);
BOOL bResults = FALSE;
BOOL bDone = FALSE;
DWORD dwProxyAuthScheme = 0;
HINTERNET hSession = NULL,
hConnect = NULL,
hRequest = NULL;
hSession = WinHttpOpen( L"WinHTTP Example/1.0",
WINHTTP_ACCESS_TYPE_DEFAULT_PROXY,
WINHTTP_NO_PROXY_NAME,
WINHTTP_NO_PROXY_BYPASS, 0 );
INTERNET_PORT nPort = INTERNET_DEFAULT_HTTPS_PORT;
if( hSession )
hConnect = WinHttpConnect( hSession,
L"connect.microsoft.com",
nPort, 0 );
if( hConnect )
hRequest = WinHttpOpenRequest( hConnect,
L"GET",
L"/dashboard",
NULL,
WINHTTP_NO_REFERER,
WINHTTP_DEFAULT_ACCEPT_TYPES,
WINHTTP_FLAG_SECURE);
if( hRequest == NULL )
bDone = TRUE;
while( !bDone )
{
if( dwProxyAuthScheme != 0 )
bResults = WinHttpSetCredentials( hRequest,
WINHTTP_AUTH_TARGET_PROXY,
dwProxyAuthScheme,
L"username@hotmail.com",
L"passport password",
NULL );
bResults = WinHttpSendRequest( hRequest,
WINHTTP_NO_ADDITIONAL_HEADERS,
0,
WINHTTP_NO_REQUEST_DATA,
0,
0,
0 );
if( bResults )
bResults = WinHttpReceiveResponse( hRequest, NULL );
if( !bResults && GetLastError( ) == ERROR_WINHTTP_RESEND_REQUEST)
continue;
if( bResults )
bResults = WinHttpQueryHeaders( hRequest,
WINHTTP_QUERY_STATUS_CODE |
WINHTTP_QUERY_FLAG_NUMBER,
NULL,
&dwStatusCode,
&dwSize,
NULL );
if( bResults )
{
switch( dwStatusCode )
{
case 200:
printf( "The resource was successfully retrieved.\n" );
bDone = TRUE;
break;
case 401:
printf(" The server requires authentication. Sending credentials...\n" );
bDone = TRUE;
break;
case 407:
printf( "The proxy requires authentication. Sending credentials...\n" );
bDone = TRUE;
break;
default:
printf("Error. Status code %d returned.\n", dwStatusCode);
bDone = TRUE;
}
}
dwLastStatus = dwStatusCode;
if( !bResults )
bDone = TRUE;
}
if( !bResults )
{
DWORD dwLastError = GetLastError( );
printf( "Error %d has occurred.\n", dwLastError );
}
if( hRequest ) WinHttpCloseHandle( hRequest );
if( hConnect ) WinHttpCloseHandle( hConnect );
if( hSession ) WinHttpCloseHandle( hSession );
}
int main(int argc, char* argv[])
{
WinHttpAuthSample();
return 0;
}
thanks in advance,
George
|
|
|
|
|
Hi
what is the procedure for Microsoft visual C++ certification?How to do that and which code come for vc++ certification ..i have no idea about that so please tell me ..
Thanks
Raju K
|
|
|
|
|
Microsoft does NOT offer any certification course for Visual C++. There may be others providing certification on the same, but certifications are crap anyway.
If you master the language properly, you won't ever need any certificate. But that's just my opinion.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|