|
Hi!
In my main dialog (the dialog that appears when I run my app) I have a button that opens a second dialog (the dialog box have a WS_POPUP style), in the main dialog I want to start a timer + change the text of some controls (statics etc.)
Now to the problem: I have code to do that when I close the dialog. But I want to start a timer and change some stuff immediate when I push a button on the second dialog!! HOW!??
/*
BETA
*/
|
|
|
|
|
But I want to start a timer and change some stuff immediate when I push a button on the second
You push on a second dialog and want to change something on a second dialog? Or push on a second and want to change on first?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
are these modaless dialogs u r talkin bout???
|
|
|
|
|
In my program I'm calling a stored procedure (SQL Server) several times. Most of the times it works fine, but eventually I get the following exception:
"Could not allocate a new object descriptor for required system catalog in database '6'. Another database must be closed or objects in another database dropped in order to open this database."
Here's the code that generates the exception:
prsStolpe->MoveFirst();
CString sql;
sql.Format("{CALL TabortBesiktning(%d, %d)}",
prsStolpe->m_LinjeomradeId, prsStolpe->m_StolpeId);
prsStolpe->m_pDatabase->ExecuteSQL(sql);
prsStolpe->Edit();
Initiera();
prsStolpe->Update();
I suspect that the combination of recordset and ExecuteSQL might cause the exception, but then I don't understand why it works fine for several calls before the exception occurs.
I did a search on the exception string and read something about the cause being "resource limitation". What resource would that be?
Please help me out if you can. I'm as confused as a baby in a topless bar.
Thanks!
|
|
|
|
|
Hi,
I have a suspicion that there is a memory leak in a ActiveX App that I am working on.
The reason for the suspicion is the containing application occassionally doesn't redraw correctly.
During this investigation i am going to ignore the activeX technology for the moment.
Anyway, i am sifting through the code to make sure that all mallocs are properly free and dynamic objects destroyed. But surely a problem with one of these wouldn't cause the current symptons.
Some one sugested that the problem might be caused by messages which are left when the app finishes? is this likely? How would i handle it? Anyone any other ideas of what to watch out for?
Thanks Again
Rich
|
|
|
|
|
Can we know the available memory at runtime in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
If anybody knows plz answer me.
|
|
|
|
|
Take a look at GlobalMemoryStatus
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
in other words how can we make sure that our program doesn't have any memory (even a single byre.)?
Your program always uses some memory. What exactly do you want to achieve?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, the question is incomplete. How can i be sure that my program( program or an activex component)doesn't have any memory leaks and how can i prove it to somebody else.
Thanx in advance.
|
|
|
|
|
Hi,
I'm trying to change the value of a recordset's property. The property is "scroll backwards" (want to change from false to true).
I opened a recordset, and then I got it's properties. I got the wanted property(according to it's index), but I can't change the value - I get an error saying that "the operation can't be done when the object is open".
Which object is the error talking about?
Do I need to change the property after openning the recordset?
What am I doing wrong?
Can someone please send me a code example of what should I do...???
Thanks.
|
|
|
|
|
hey, i know that this will sound stupid, but i can't find any function that changes the static control's text color. Example of doing that?
Thanks,
Deian
|
|
|
|
|
Put this in the OnCtlColor
if(nCtlColor==CTLCOLOR_STATIC )
{
pDC->SetBkColor(RGB(255,9,9));
pDC->SetTextColor(RGB(9,9,255));
}
Replace the RGB values with what you prefer
Regards
Nish
Sonork ID 100.9786 voidmain
|
|
|
|
|
Such function is not present, you're must override OnCtlColor() function
HBRUSH ...OnCtlColor(...)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_STATIC1)
{
pDC->SetBkMode(TRANSPARENT);
pDC->SetTextColor (RGB (255, 0, 0));
}
return hbr;
}
|
|
|
|
|
There's no direct way to accomplish this, and others have already pointed out the method to be used. If you want to save you the pain of writing and maintaining this kind of stuff, why not have a look at Yuri Goltsam's Colored/Blinking Controls and Dialogs with any Font article. Simple drop-in solution. I specially like the idea of providing the functionality as a template class, wish this technique was more widely known and adopted.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks
|
|
|
|
|
hi there...
well im new 2 vc so bear my kiddish query
i have an SDI and have a variable of CString in CDocument...
my view class is of type CEditView and i want to save the
contents typed in the edit view in my doc CString variable and then this variable to disk using the file_save button on the toolbar...
thanx in advance
|
|
|
|
|
Hi, can i know how to use median and averaging filter? My program now can capture real image using digital camera. But how do i reduce the noise using averaging and median filter?? I'm beginner to this and do not know what the filters are for. Please help. Thanks Alot!
Regards,
Michelle
|
|
|
|
|
|
I was just pondering one day ....
Well anyway, how would one go about coding a boot disk, like the win98 boot disk, lilo, norton ghost, etc. What kind of code would be necessary so that the system doesn't give an Invalid System Disk Error?
Well what do you know...I ended up finding something already. Heh. Fugetaboutit!
Stephen Caldwell
Blackfission, CEO
http://bf.steffc.yi.org:81
|
|
|
|
|
|
From a DOS/Win3.1/Win95/Win98 machine, do a "format a: /s"
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
Ok, I'm wanting to have VC++ go to open a file and go to a particular line in the file... the filename and line number will be sent from an *external* application.
So far, my idea was to write a VC++ add-in that opened a named pipe at waited for a message from the external app. (If someone has a better suggestion, please let me know...) Here is my problem:
In CDSAddIn::OnConnection(...), I create a new thread with AfxBeginThread(...) that makes the pipe and waits. After receiving the message, the pipe calls a new function in the CCommands class, which in turn should open the passed file and go to the line as so:
STDMETHODIMP CCommands::OpenAndGoTo(BSTR szFilename, int nLine)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
IDocuments* pDocuments = NULL;
m_pApplication->get_Documents((IDispatch**)&pDocuments);
// open the file
ITextDocument* pDoc = NULL;
CComBSTR bstrFileName = szFilename;
CComVariant vtDocType = "Text";
CComVariant vtReadOnly = FALSE;
pDocuments->Open(bstrFileName, vtDocType, vtReadOnly, (IDispatch**)&pDoc);
// TODO: go to the line number
return S_OK;
}
Everything works fine until the call to pDocuments->Open(...), which crashes with an unhandled exception: access violation error. The really weird thing is, the exact same function works perfectly fine when called from somewhere inside the main thread (i.e. if I call the function from the CDSAddIn::OnConnection(...) function, everything works perfect). It only crashes when I call the function from the created thread. Any ideas as to why?!
Thanks for your help...
~ Stevo
|
|
|
|
|
I'm actually having a similar problem but not with add-ins.
I have an MFC application that has the Python interpreter embedded in it. We use Python to script our automation stuff. When I had the script running in the main thread, I could automate all the framework stuff (opening files, changing the views, etc). When I moved the script into a worker thread, all of a sudden all my framework manipulation started throwing weird access violations. I traced them down and it looks like the framework is asserting when it goes to touch one of the windows. It looks like the hWnd is null or bad or different or something.
I get the feeling that the MFC framework has issues with multi-threaded access to its internals.
If you figure it out, please let me know.
J
|
|
|
|
|
dear all VC++ programmers. i'm a bigginer VC++ programmer, my first MCP in the MCSD for VC++, which is Desktop applications, will be next monday.i have 9 questions need answer and i don't know thier answers so could any one please help me an answer these questions.
here you are the questions.
1 – you want to use a form view in your MFC-MDI application. You add a close button to the dialog resource that will be used with the form view. You then add to the form view class a button click handler for the close button you want the button click handler for the close button to close MIDI child window that contains the form view.
What must you do in the button click handler of the close button to accomplish this goal?
A. Post the WM_CLOSE message to the form view.
B. Call the DestroyWindow function in the form view.
C. Post the WM_CLOSE message to the parent frame window of the form view.
D. Call the DestroyWindow function on the parent frame window of the form view.
2 – your program uses a COM component. The COM server object has returned a standard HRESULT with a severity field of 1. you want to present to the user a message box explaining what the returned HRESULT means. You need the message string corresponding to that HRESULT.
How must you obtain this string?
A. call OutputDebugString.
B. Call FormatMessage(FORMAT_MESSAGE_FROM_STRING,…);
C. Call FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM,…);
D. Call GetLastError.
3- you are using VC++ to create COM component that will scan files for conformance to validity constraints. The component might be used by many client programs at the same time. To avoid duplicate scanning, the component maintains an internal list of files it has scanned. The component does not persist this list when it unloads.
Which type of COM component should you create?
A. active document.
B. ActiveX user interface control.
C. Out-of-process COM server component.
D. In-process COM server component.
4 – you are the administrator of the Microsoft Visual Source Safe database for you company’s main software product. You want to retrieve the code tree from the previous day and rebuild the entire project on a clean system. Only one file has been changed since yesterday. You want to retrieve the code tree from the previous day while preserving today’s changes to this file.
What should you do?
A. Click Show History for the changed file, click Pin, and then click Get Last Version for the project.
B. Click Show History for the changed file, click Rollback, and then click Get Last Version for the project.
C. Branch the project, click Show History for the changed file, click Rollback, and then click Get Latest Version for the project.
D. Branch the project, click Show History, click Pin, then click Get Latest Version for the project.
4 – you want to restrict the size of s frame window in your VC++ windows-based application. You add code to handle WM_SIZE message.
The frame window is now initially displayed in a large frame, and then it snaps to the correct size. In addition, auser can drag the frame to any size while holding down the mouse button.
How should you restrict the size of the frame window?
A. Add the code that restricts the frame size to the WM_GETMINMAXINFO message handler.
B. Add the code that restricts the frame size to the AdjusWindowRectEx function.
C. If the unadjusted frame window too big, resend the WM_SIZE message at the end of the WM_SIZE message handler.
D. Add the code that restricts the frame size to the ON_WM_CREATE message handler.
5 – your company maintains a library of documents in a proprietary format on the intranet. You write an active document component to edit documents of this format.
To manage these documents, you will run the component in Microsoft Internet Explorer on your company’s intranet. When a user clicks a link to one of these documents, Internet Explorer will automatically launch your active document to edit it. You want to obtain in the active document the URL of the document that Internet Explorer has activated.
What must you do?
A. Call the Imoniker::RelavtivePathTo method.
B. Implement the IoleLink::GetBoundSource method.
C. Call the IoleClientSite::GetMoniker method.
D. Call the Imoniker::GetDisplayName method.
E. Implement the IoleObject::GetClientSite method.
6 – you write an ActiveX user interface control by using VC++, the control has a number of properties. You want to accomplish the following goals:
1. Display the available properties on property pages of the control.
2. Allow access to the control properties from Microsoft Visual Basic.
3. Constrain some properties to predefined values.
4. Load ambient property values from the control container.
5. Indicate which user interface element of the control receives focus when the control is loaded.
You implemented the IpropertyBrowsing interface on the control.
Which result or results does this action produce?(choose all that apply)
A. Display the available properties on property pages of the control.
B. Allow access to the control properties from Microsoft Visual Basic.
C. Constrain some properties to predefined values.
D. Load ambient property values from the control container.
E. Indicate which user interface element of the control receives focus when the control is loaded.
7 – you are implementing a COM component by using ATL. You paln to use ATL features wherever possible. You want to allow other COM components to reuse your component by aggregating it.
Which three things must you do?(choose three)
A. Declare an internal reference count for the component.
B. Declare a pointer to the controlling Iunknown interface.
C. Override the FinalConstruct method.
D. Override the FinalRelease method.
E. Override the IclassFactory::CreateInstance method.
F. Add the DECLARE_CLASSFACTORY2 macro to your class.
8 – you write a COM component by using VC++. The component supports the ImangeSales interface, which your company has defined. The component is designed to support aggregation, and it provides a class factory object.
A client object males a call to the CreateInstance function of the class factory object, requesting an instance of the ImanageSales interface. The client object passes a non-NULL pointer to the controlling unknown as a paramater of the CreateInstance call.
Which value must your component’s QueryInterface function return?
A. a pointer to the ImanageSales interface.
B. A pointer to the Iunknown interface.
C. A NULL pointer.
D. CLASS_E_NOAGGREGATION.
E. CLASS_E_CLASSNOTAVAILABLE.
F. S_OK.
9 – a real estate company hires you to develop an application to display homes that are available for sale. You create an ActiveX user interface control that allows the broker to enter a postal code. The application then displays a map of the appropriate area. Homes that are for sale are highlighted on the map. The application sets its color scheme independently of the Control Panel color settings. You want your control to follow the color scheme of the application.
Which two things must you do to accomplish this goal?(choose two)
A. Implement IoleControl::SetColorScheme.
B. Call Idispatch::Invoke(DISPID_AMBIENT_BACKCOLOR,…).
C. Implement IoleControl::OnAmbientPropertyChange.
D. Call IoleControlSite::OnControlInfoChanged.
E. Implement IoleControl::GetControlInfo.
Assem Abdel Maqsoud
C/C++ programmer
|
|
|
|
|
So let's see if I get this right.. you're a beginner, but you want people to pay you like you're experienced - so you try to get the MS "certification" that supposedly tells the world you know what you're doing.
But you don't know what you're doing - so you come to us for help. Is that right?
|
|
|
|