|
I have created an SDI application with an extensive dialog-based interface for a project at work.
I would like to create a new SDI application and import my existing interface classes and dialog GUIs. Is this possible?
Is there a dialog "import" capability in VC++ that I could use to load existing interfaces into a new project, or do I have to directly edit any files?
Thanks,
Kim Rudeen
|
|
|
|
|
I always copy and paste from the .rc and resource.h files to move dialogs between programs. You can also specify extra resource files, but I've never really learned how because it seemed messy and getting dirty with the text files gives me a feeling of control that appeals to my rapidly dwindling sense of manhood.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Hello,
I have a simple Dialog Box with 2 Timers. One displays the current time ,the other is a Count down timer. When the count down timer reaches a certian time I would like it to display a simple MessageBox.. Here is a sample of the OnTimer(UINT nIDEvent)code where I think I should place the code to display the MessageBox..
void CTimerDlg::OnTimer(UINT nIDEvent)
{
//Which timer triggered this event?
switch (nIDEvent)
{
//The Current Time?
case IDC_TIMER1:
//Display the current time
m_timer1.DisplayCurrentTime();
break;
//The Count Down Timer?
case IDC_TIMER2:
//Increment the count
m_iCount--;
//format and display the count
m_timer2.Display(m_iCount,iM,iH,iD,(CString)m_strTimer2="%D:%H:%M:%S");
break;
}
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
Any Ideas would be appreciated!!!
THANKS!
Rob
|
|
|
|
|
You might like to put UpdateData() at the top of this, I assume the variable being decrimented is in a dialog box ? Apart from that, it's self evident. Check the timer variable for the value you want, and pop up the dialog if it matches.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Thanks, I put the UpdateData(TRUE); at the top of this. I have tried several different ways of Checking the timer variable for the value I want but none seem to trigger the event.. I assume I have to compare the m_strTimer2 CString to a CString variable.. here is just one of the ways I have tried.. (Don't laugh.. I'm new at this)
Here is a portion of the code...
.
.
.
case IDC_TIMER2:
//Increment the count
m_iCount--;
//format and display the count
m_timer2.Display(m_iCount,iM,iH,iD,(CString)m_strTimer2="%D:%H:%M:%S");
break;
}
if(m_strTimer2 == "55") // Which I believe is 55 seconds..
{
MessageBox("15 Seconds");
}
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
Thanks,
Rob Jones
|
|
|
|
|
> Thanks, I put the UpdateData(TRUE); at the top of this. I have tried several different ways of Checking the timer
>variable for the value I want but none seem to trigger the event.. I assume I have to compare the m_strTimer2 CString
>to a CString variable.. here is just one of the ways I have tried.. (Don't laugh.. I'm new at this)
Don't worry - I almost never laugh ( I was once new at this, too )
Here is a portion of the code...
.
.
.
case IDC_TIMER2:
//Increment the count
m_iCount--;
//format and display the count
m_timer2.Display(m_iCount,iM,iH,iD,(CString)m_strTimer2="%D:%H:%M:%S");
break;
}
if(m_strTimer2 == "55") // Which I believe is 55 seconds..
{
MessageBox("15 Seconds");
}
UpdateData(FALSE);
CDialog::OnTimer(nIDEvent);
}
Why compare the string ? It's never going to *equal* 55, if it's formated to include other characters like ':'. You need in the least to say
if (m_StrTimer2.Left(2) == "55")
and I would tend to ignore the formatted string and do comparisons on the integers you used to format the string in the first place.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I am unable to use comparisons of the intergers because I set the int's value through edit boxes on the dialog application.. e.g (If I want to start the count down timer at 1 day, 1 hour and 1 minute I have 3 edit boxes that I put the information into).I use "void CTimerDlg::onChangeEditBox1()" UpdateData(TRUE); to allow me to input values into the edit boxes. Then onStartTimerButton takes the values from the edit boxes and puts them into the string..etc.. If I look for a change in a int it seems to only trigger when the value is equal to the edit box and I click start timer..not sure what to do.. I tried the m_strTimer2.Left(2) == "55" but that doesnt seem to work either...
Thanks,
Rob Jones
|
|
|
|
|
When you call UpdateData at the top, it pulls down the values into the variables. It's often a good idea to use <= if the value is decrementing rather than ==. There is no reason why, if you call UpdateData properly, you cannot do comparisons on this variable, in the same way you are passing it to a formatting function. It's probably time for you to do some tracing and see what is going on.
If you type TRACE("%d %s\n\r", m_timer(whatever it's called), m_StrTimer); and debug, you will get an output that shows you the values you are dealing with. That should give you a good idea why the values are failing to compare, both as a string and an integer.
Also, if you made the time a float, it will never *equal* 55, it will simply be less than 56 Other than that, without having the source here, I'm not sure what is going on.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Thanks for all your help!;)
Rob Jones
|
|
|
|
|
The m_strTimer2 String all ways seems to equal 0.. any ideas?
Rob Jones
|
|
|
|
|
I have a section of code that loads winspool.drv (at least I think that's what it's called). Due to what is going on at the time, this results in a bothersome performance hit. Is there a way to load this driver in earlier?
Thanks.
Paul Ebert
|
|
|
|
|
How do you stop a button from becoming 'default' (the thick black line around it) when it is clicked on?
|
|
|
|
|
you can modify the style of button by removing the BS_DEFPUSHBUTTON style
DWORD style=btn.GetButtonStyle()
style&=~BS_DEFPUSHBUTTON;
btn.SetButtonStyle(style);
|
|
|
|
|
I would like to know how can we handle messages from a child control, for example if a build a custom control that inside I create two edit control how I handle messages from both edit independently?
If I add an ON_EN_UPDATE or ON_EN_CHANGE handler it's ok for one edit but not for two.
Thanks for any help.
|
|
|
|
|
Using ON_EN_UPDATE is fine for two. They both have unique ID's so the messages can be mapped to unique functions.
Michael A Barnhart
mabtech@swbell.net
|
|
|
|
|
I have an MFC MDI application that works fine. I'm trying to add another window, outside of the main MDI window. When I create the child view for this 2nd window, a new blank view appears in the main MDI window, leaving the 2nd window frame blank. The frame, and view class are different for the 2nd window. I've tried tracing through the code and I can't figure out how the main window takes my new child window. There's something built into MFC that is causing this. What am I missing, how can I work around it? Naturally, I can create the window and ignore the frame/document/view architecture, but I'd rather not do that. If the following looks a bit strange, I'm following the example of an MFC wizard generated app without document and view support (the document isn't needed). I'm using this approach to try and reduce the ties to frame/document/view and make this work. Tried it the standard way and it didn't go either.
{
CMDIFrameWnd* pFrame2 = new CCalendarFrame;
// create secondary MDI frame window
if (!pFrame2->LoadFrame(IDR_CALENDARTYPE)) return;
// create a new MDI child window
pFrame2->CreateNewChild(
RUNTIME_CLASS(CCalChildFrm), IDR_CALENDARTYPE, NULL, NULL);
// The main window has been initialized, so show and update it.
pFrame2->ShowWindow(SW_SHOWNORMAL);
pFrame2->UpdateWindow();
}
Thanks!
|
|
|
|
|
Hi,
I have a (context menu) shell extension registered to both exefiles and dll files under W2K SP1. I've also entered the required info in the HKLM\Software\Micrsoft\Windows\CurrentVersion\Shell Extensions\Approved key.
The problem is that the extension works fine for all exe files but does not even load with dll files. I checked to make sure there is an entry under HKCR\dllfile\shellex\contextmenuhandlers. What's weird is that when I use regmon I see what's going on, I notice that explorer makes no attempt to even look at that key.
The code is based on the one found at
http://www.codeproject.com/shell/shellextguide2.asp
Any ideas??
Thanks,
Jignesh
|
|
|
|
|
|
Yes it does... I just tested this on another machine running W2K (SP1) and the extension works correctly for both (exe and dll).
I really am confused!
Thanks,
Jignesh
|
|
|
|
|
Hello,
One of the interesting things the WebBrowser (WB) control may be used for is to view a document through document automation object.
At some moment I need to free all of the COM Servers created by WB without destroying the WB object,
passing “about:blank” frees WB view, but does not liberate Automation Servers.
1)Is there a way to force WB to free opened Servers? Is it possible to get to the list of run Servers?
When a document (file) does not have an Automation Server,
it’s run somewhat through the ShellExecute, and if so,
having a ShellExecute hook does not notify the operation,
there must be some other run method ?
2)Is there a way to get at least Window handle of the opened application?
Any ideas will be highly appreciated.
Thanks in advance, Alexandre
Software developer
|
|
|
|
|
Hi.
I have a View in which user can draw vectors. Each vector can be selected,( highlighted).
I also have a modeless dialog which has a ListBox each line represents a vector in the
View.
I need to do: when I select a line in the ListBox which is in Dialog my program will also
highlight an appropriate vector.
In a nut shell:
I don't know how to send to a View a message that line in the list box was highlighted,
so it will highlight the appropriate vectors.
thanks ahead.
bye.
|
|
|
|
|
To get the view from anywhere
CFrameWnd *pFrameWnd = (CFrameWnd *)AfxGetMainWnd();
ASSERT (pFrameWnd != NULL && pFrameWnd->IsKindOf(RUNTIME_CLASS(CMDIFrameWnd))); // or CFrameWnd if SDI
pFrameWnd = ((CMDIFrameWnd *)pFrameWnd)->GetActiveFrame(); // or CFrameWnd if SDI
CMyView * pView = (CMyView*)pFrameWnd->GetActiveView();
CMyDoc * pDoc = (CMyDoc*)pFrameWnd->GetActiveDocument();
Then it's a case of writing a function that takes the info and updates the display, and calling it. In fact, the above code is through all the dialog boxes in my paint program for exactly the same sort of thing you are describing.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I wanted to know how software like GetRight and Gozzila can do to intercept the http or ftp connections in internet explorer or netscape right when the user click on it?
Crocmort
|
|
|
|
|
For I.E I think they are using an IEHelper Object
When an instance of Internet Explorer is started, it looks in the registry for CLSIDs stored under the following key:
HKLM\SOFTWARE\Microsoft\Windows \CurrentVersion\Explorer\Browser Helper Objects
If this key exists and there are CLSIDs listed under it, Internet Explorer will use CoCreateInstance() to try to create an instance of each object listed as a subkey under this key. Note that the CLSID of the object you create must be listed as a subkey and not a named value.
There are some requirements when creating a Browser Helper Object
1 The application that you create must be an in-proc server (that is, DLL).
2 This DLL must implement IObjectWithSite.
3 The IObjectWithSite::SetSite() method must be implemented
Also It is possible to connect to a running instance of Internet Explorer version 4.0 or later using the SHDocVw.ShellWindows collection.
Regards
Alfadhly
<marquee>
It is Illogical to define an inventor by his invention
|
|
|
|
|
I am using the CBitmapDC class to assemble bitmap files into a larger one to print in OnPrint.
Print preview shows the picture ok, but the page is blank (not much of a preview if you ask me). I understand that this is due to CBitmap being a DDB, and I need to convert it to a DIB before printing.
This has me very confused with all the different sample code and classes. It appears to me that I AM using a DIB when I load the BMP (according to docs, BMPs are in DIB format). Somehow, a CBitmap is not the same thing?
Any help getting a CBitmap to print on the printerDC (hDC, whatever) would be beneficial to my sanity.
Rick
|
|
|
|