Thanks for your response. It helped me partailly but I guess now I can solve that. Once again thank you for your response! Regards, Tony
tony_Udz
Posts
-
PrintPreview in MFC SDI Application -
PrintPreview in MFC SDI ApplicationHi, I am facing problem in my project and to simulate this problem I have reproduced in sample application. I have created a SDI MFC app with doc view architecture. I am facing problem while Print preview. While I close the preview Window, application hangs and after some time it crashed. Following is the implementation of OnFilePrintPreview and OnEndPrintPreview: void CSampleView::OnFilePrintPreview() { // must not create this on the frame. Must outlive this function CPrintPreviewState* pState = new CPrintPreviewState; // temporary remove the parent so that the DoPrintPreview() uses the mainframe ShowWindow(SW_HIDE); SetParent(NULL); //AfxMessageBox("Before DoPrintPreview"); if (!DoPrintPreview(AFX_IDD_PREVIEW_TOOLBAR, this, RUNTIME_CLASS(CPreviewView), pState)) { //AfxMessageBox("After DoPrintPreview IF"); // In derived classes, reverse special window handling here for // Preview failure case TRACE0("Error: DoPrintPreview failed.\n"); AfxMessageBox(AFX_IDP_COMMAND_FAILURE); delete pState; // preview failed to initialize, delete State now } //AfxMessageBox("After DoPrintPreview"); } void CSampleView::OnEndPrintPreview( CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView) { pView->DestroyWindow(); SetParent(AfxGetApp()->m_pMainWnd); AfxGetApp()->m_pMainWnd->ShowWindow(SW_SHOW); AfxGetApp()->m_pMainWnd->UpdateWindow(); } Please provide input on this if anybody has any idea on this. Thanks in Advance!! Regards, Tony
-
CoInittialize Fails with large number of processes [modified]Hello, I am facing problem while calling CoInitialize(). Here is the sample code: ABC.exe ======= for (int i = 0; i < 150; i++) { if (!SUCCEEDED(::CoInitialize(NULL))) { MessageBox(NULL, "CoInitialize Failed", "Failed", 0); } COleMessageFilter* pTempObj = new COleMessageFilter; BOOL bResult = pTempObj->Register(); ::CoUninitialize(); } XYZ.exe ======= In XYZ.exe i am invoking ABC.exe for more then 750 times. After invoking around 500 exes, there is an error for CoInitialize . If i put a sleep of 1 second in for loop, then there is no error. I have simulated my problem using the above sample code. In fact, I am getting error as 0x80070583 and system error as 1411 (Class does not exist). Thanks in Advance! Regards, Tony
modified on Monday, July 12, 2010 12:07 AM
-
Using library built in VC 8.0 or VC 7.0 in Application built in VC6.0Hello, I want to use a function from .lib file(which is built on VC 8.0 and VC 7.0) and my application is built in VC 6.0. On calling function (from .lib) i get large number of linker errors. I beleive this is because one of the one of the linker warning "warning LNK4078: multiple ".CRT" sections found with different attributes (40300040)" Please advice. Thanks in Advance!
-
Changing Windows Vista control panel settings (control panel>ease of access center>optimize visual display>make the focus rectangle thicker)Thanks for your kind concern but it isn't very helpful. Actually i am looking where would OS store the changed settings for "control panel>ease of access center>optimize visual display>make the focus rectangle thicker". I have gone through registry but could not find it :(. Thanks again
-
Changing Windows Vista control panel settings (control panel>ease of access center>optimize visual display>make the focus rectangle thicker)Hello, I want to change control panel settings in Windows Vista(control panel>ease of access center>optimize visual display>make the focus rectangle thicker). For this particular settings following values 'FocusBorderHeight' and 'FocusBorderWidth' at "HKCU\Control Panel\Desktop" changes in Windows registry. But when i changed these values settings were not getting changed. Does anyone has idea how to change this particular control panel settings in Windows Vista. Thanks in Advance!!
-
Resource DLL not loading to processEntry point has been very correctly set and in fact it is working fine with WinXP and Win Vista. But same code is failing with Windows 7. Any idea about it?
-
Resource DLL not loading to processCString strPath = "C:\\Test\\SampleResource.dll"; CFileFind Ff; bool bIsFilePresent = Ff.FindFile(strPath); // It returns true HINSTANCE hTest = LoadLibrary(strPath); // It returns NULL DWORD dwError = GetLastError();// It returns 126 I hope this piece of code is understandable. Thanks.
-
Resource DLL not loading to processHi, I m trying to load a resource dll to my application but its failing with error code 126(which says dll not found). I have also checked the path manually as well as using CFileFind (and it shows that dll is there). One more thing i have also checked the same code with normal dll(i.e. which has some code) and it works absolutely fine. Does anyone has any idea or hint about this? Is it related to trusted dll? Thanks in Advance! Tony
-
Monitoring network traffic on LAN using VC++Yeah thats what Bandwidth is always changing. So i need to know the Bandwidth of a LAN everytime i send data.
-
Monitoring network traffic on LAN using VC++Thanks for the help but these articles explains about monitoring bandwidth of internet whereas i want for LAN. Also i tried googling for this topic but was not successful enough.
-
Monitoring network traffic on LAN using VC++Hi, I want to monitor network traffic of LAN. Basically, my current application is continously transferring data from one computer to another on LAN. Currently i have fixed the tranfer rate i.e. in my application i have mentioned tranfer rate of 32 KB. Now i am planning to optimize my application by changing tranfer rate dynamically. That is, i'll calculate bandwidth of LAN and depending upon the availability i'll send data. Please help Thanks in Advance!! Regards, Tony
-
diamond problem and virtual inheritanceHi, Try the following code it might help you: ========================================================================== #include "iostream.h" #include "stdio.h" class A { public: int m_nAInt; A(int n = 1):m_nAInt(n) { cout << "Class A Constructor called" << endl; } Display() { cout << "A::Display()" << endl; } }; class B: public virtual A { public: B() { cout << "Class B Constructor called" << endl; } }; class C: public virtual A { public: C() { cout << "Class C Constructor called" << endl; } }; class D: public B, C { public: D() { cout << "Class D Constructor called" << endl; } }; int main(int argc, char* argv[]) { D dObj; dObj.Display(); return 0; } ==========================================================================
-
Using MySQl with VC++Can i go like this as well ========================================================================================= try { CDaoDatabase* pCDaoDb = NULL; CDaoRecordset* pPointsSet = NULL; pCDaoDb = new CDaoDatabase(); pCDaoDb->Open("C:\\temp\\sample2.mdb", FALSE, FALSE, ""); pPointsSet = new CDaoRecordset(pCDaoDb); if (!pPointsSet->IsOpen()) { pPointsSet->Open(dbOpenTable, "STUDENT", 0); } COleVariant oleVariant; oleVariant = pPointsSet->GetFieldValue("STUDENTID"); long lTemp = oleVariant.lVal; oleVariant = pPointsSet->GetFieldValue("Address"); CString strTemp = oleVariant.pcVal; CString strTemp2 = strTemp.AllocSysString(); int nCount = pPointsSet->GetRecordCount(); //pPointsSet-> } catch(CDaoException* e) { //int nError = e->ReportError(); CString error = e->m_pErrorInfo->m_strDescription; MessageBox( NULL, error, "ERROR", MB_OK ); } =========================================================================================
-
Using MySQl with VC++Hi, I intend to make a sample application in VC++ to using MySQL databases. Can anybody suggest me where and how to start? I am new to databases any help would be great. Thanks in Advance!! Regards, Tony
-
CSocket threading issueReally thankful for your solution :)
-
CSocket threading issueHello, I have written a client server application using sockets. In this application, server will send data to client. I have used CSocket(MFC) for this purpose. Server side application is working fine but problems start as soon as i had intoduced threading inside it. Below is my code: /////////////////////////////////////////////////////////// UINT __cdecl ThreadProc( LPVOID pParam ); // Signature of thread proc AfxSocketInit(NULL); CSocket sockSrvr; sockSrvr.Create(PORT); BOOL bListen = sockSrvr.Listen(); while (1) { CSocket sockRecv; sockSrvr.Accept(sockRecv); AfxBeginThread(ThreadProc, &sockRecv); Sleep(5000); } /////////////////////////////////////////////////////////// I pass address of CSocket as parameter of 'ThreadProc' and as soon as control enters 'ThreadProc' iget a debug assertion faliure from sockcore.cpp at the following line: ASSERT(pState->m_hSocketWindow != NULL); Can anybody of you please help me i am not able to understan wats wrong to this code? Thanks in Advance!! Regards Tony
-
BHO failing in Windows 2003 ServerI found the problem. In Windows Server 2003, i had to enable 'Enable Third Party Browser' from Tools-> Internet Options --> Advanced --> Enable Third Party browser extensions (requires restart). Thanks for your help!!
-
BHO failing in Windows 2003 ServerActually, to debug this dll i have inserted a MessageBox() in every function, For e.g. In windows XP flow is as follows: - When dll is registered flow is as follows: - 1) DllMain. 2) Dll Register Server. 3) Dll Main. When you open Explorer.exe 1) Dll Main. 2) Dll GetCLassObject. 3) SetSite. When you close Explorer.exe 1) Dll Can Unload. 2) DllMain. But in Windows 2003 flow is as follows: - When dll is registered flow is as follows: - 1) DllMain. 2) Dll Register Server. 3) Dll Main. When you open Explorer.exe No call to DLLMain. I dont know for few unknown reason DLLMain could not be called. Please let me know if you have still not understood the problem.
-
BHO failing in Windows 2003 ServerI mean to say BHO Dll is not loaded when exlorer.exe is laucnched. If you have any idea about this please let me know. My concern is that is ther any significant difference between Win XP and Win 2003 Server with reference to BHo.