|
|
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
|
|
|
|
|
thanks to your replay rajesh
actually one of my friend finished he is also working in VC++ but i am not sure he is finished vc++ certification ..
i know he done the subject code 70-536
anyway thanks rajesh
|
|
|
|
|
BTW, how many more new IDs are you going to create at CodeProject? We have watchful eyes, you see. I can make it out easily from your grammar and writing style.
I remember these IDs of you - they may not be accurate, you get the picture:
raju k, nisha00005 (2 more along the lines with the name nisha), madan(something), etc., You were also a noted member of the Book Buying Band.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Certifications aren't for shouting people.
BTW:
(1) rarely skilled developers need a certification.
(2) rarely a certified developer is skilled.
[added]
I notice you've found yourself the right way to enhance you developer's reputation [^]. Well done, I give you two suggestions:
(1) give the correct answer.
(2) post your answer to the original question, not to another answer.
[/added]
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]
|
|
|
|
|