|
Thanks for the help!
paully
|
|
|
|
|
I have remade APPBAR sample from MSDN.
It works OK, but when no explorer is running (e.g. TaskBar is not present), other windows can obscure my appbar. What should I do?
|
|
|
|
|
I have 1 dialog with 4 edit boxes. Their variables are of type double. I have two other varibles that need to be included in my second dialog as static text.
To make this simple:
m_varA = m_editA \ m_editB;
m_varB = m_editC \ m_editD;
I want my static text to represent m_varA and m_varB. My code for the button that opens the new dialog is as follows:
{<br />
m_m = (m_strY2 - m_strY1) / (m_strX2 - m_strX2);<br />
if(m_strY1 < 0)<br />
{<br />
m_b = (m_strY1 + m_m * m_strX1);<br />
}<br />
else<br />
{<br />
m_b = m_strY1 - (m_m * m_strX1);<br />
}<br />
m_m = CSlopeDlg.m_m;<br />
m_b = CSlopeDlg.m_b;<br />
m_dCSlopeDlg.DoModal ();<br />
}
Where m_strX1, Y1, X2, Y2 are my edit boxes. m_m is one of the variables that I want to be displayed in my other dialog, and so with m_b.
All of my variables are of type double as I said before.
CSlopeDlg.m_m is the euqivilant of m_m in my first dialog. It is the static text. It is of type CString. Same with CSlopeDlg.m_b.
The compiler give me the same error twice, as expected:
error C2275: 'CSlopeDlg' : illegal use of this type as an expression see declaration of 'CSlopeDlg.
What should I do?
Am I even on the right track?
Thanks,
Nicky
|
|
|
|
|
hi,
you can't use a class thing like that..you need an object first..to use it..
you can use it like this..
CSlopeDlg dlg;
m_m = dlg.m_m;
thats it..you are done..
cheers
Himanshu
|
|
|
|
|
Hi,
Thank you very much, but now it says:
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class Ctring' (or there is no acceptable coversion)
How can I convert the double type variables to CString, or the CString variable to double?
Thanks,
Nicky
|
|
|
|
|
hi,
cant u make both of them of same type...i guess u have defined them as CString and other becomes double..in your calculations...once it is any type int float or double..you can type cast it and do the work...
i hope it helps..
cheers
Himanshu
|
|
|
|
|
I want to autmat an application that is supplied as a .exe.
Can anyone suggest the best way to send message to simulate menu selections on that software ?
Thanks.
Elaine
The tigress is here
|
|
|
|
|
|
I have a dialog based application that has 2 dialogs in it. I display each of them using doModal() something like the following:
CEulaDlg eDlg;
CSetupDlg dlg;
INT_PTR nResponse = -1;
nResponse = eDlg.DoModal();
if( nResponse == IDCANCEL )
return false;
nResponse = dlg.DoModal();
if (nResponse == IDOK)
{ ...
I'm calling both AfxEnableControlContainer() and AfxInitRichEdit2() in both dialog constructors. The problem I'm having is that once I add the eDlg dialog when I run the app nothing happens. The app doesn't even appear in the process mgr after a few seconds.
There is one thing unusual, if I build it from the VS.NET GUI it runs fine. If I build it from the command line, it doesn't work.
Any ideas what I might be doing wrong?
|
|
|
|
|
Hi all,
I was wondering if anyone knew of a way to change the default C-runtime heap for a DLL. I would like a DLL that I am creating to automatically allocate its data into a different heap than the host process, and I dont really want to resort to writing my own heap manager or using the Win32 heap functions to manage memory.
Thanks
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Correct me if I am wrong, but I always thought, that the dlls have they own heap - therefore if you malloc something in DLL you are not able to free it in the EXE (or another DLL). I am not really sure about that, but it was told me in some years ago, while learning working with DLLs I allocated some resource in DLL1 and tried to free it in DLL2, getting the heap corruption message.
|
|
|
|
|
Hello Everybody,
Is there a way to put text in a dialog that the user can click and load a IE window with the URL? I tried a couple of things and nothing works. Any suggestions? Any answer is more than welcome.
Best regards,
Luis E. Cuadrado
)
|
|
|
|
|
|
One solution is ShellExecute()
ShellExecute(// Handle to window of new process.
NULL,
// Command
TEXT("open"),
// Source data
"???.???.???/???.???"
// New process paramater
NULL,
// Directory
NULL,
// Window
SW_SHOWNORMAL);
Kuphryn
|
|
|
|
|
If Ido:
BOOL ret = pImageDisplay->Create(IDD_IMAGEDISPLAY, this);
pImageDisplay->m_zoomFactor = 500;
pImageDisplay->ShowWindow(SW_SHOW);
pImageDisplayVector.push_back(pImageDisplay);
}
THe images in the modeless dialog get the info about the zoomfactor.
But........ If I pull the pointer off the vector and do this (show the window here instead):
loop through the vector:
{
pImageDisplayVector[i]->m_zoomFactor = 500
pImageDisplayVector[i]->ShowWindow(SW_SHOW);
the dialog doesnt get any zoom info.....
I'm doing something dumb? Missing something really obvious?
Appreciate your help,
ns
|
|
|
|
|
If it's a pointer then it should work both ways. What is in the vector, a CWnd derived class ?
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
It'd probably be fairly easy to make a bot that'd post random stupid VB questions, and nobody would probably ever notice - benjymous - 21-Jan-2003
|
|
|
|
|
There just isn't enough information there. It looks like it should work, but there could be 100000 other things going on.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
in the second approach r u still creating it/them pImageDisplay->Create(IDD_IMAGEDISPLAY, this);
?
-pete
"No matter where you go, there your are..." - Buckaoo Banzi
-pete
|
|
|
|
|
Yes, I create them. push_back them in one function. then, retrieve them in another function..
Another thing....I'm trying to figure out by putting in breakpoints the sequence of events. Basically I'm going to restore the Cdialogs spawned by my view using the registry. Each CDialog has a magnification member . So if the registry says there were cdialogs spawned last time, I create the cdialogs in initial update after seeing how many there were the last time it ran. Then I call another function so I dont clutter things, and in that I was going along looping and assigning the magnification saved in the regsitry to the dialogs via pointers from the vector. Finally i did showwindow on them (in this separate fuunction).
The way it looks now is that I'll have to quiz my registry for the magnification info in a function which I had wanted to dedicate only to create the CDialogsvector. ....
But I'll look some more into it befoore I spaghettify things....
Thanks everyone!
|
|
|
|
|
I have a Single Doc app. I the apps InitInstance, the program does several things, one is finding out how to configure the menus and configuring them. The top level ones work fine, File, Edit, Help - i can gray them out and enable them if I wish. But the submenues blow up the program when they go to open. I'll move to a disabled item, and click it (nothign happens of course) I move to a non-disabled one (but one who'se contents I've modified) and I get an assert. I don't have any numm handles or pointers though.
Also I am having a problem updating the screen. I can all RedrawWindow wit the RDW_FRAME flag and the menu looks corrcectly, but it erases everything in my Doc view!
Many thanks in advance!
|
|
|
|
|
It sounds like a problem of managment of graphic objects, as fonts, brushs or pens.
The first rule with these objects is to always release them before destroying the device context using these objects
I suppose its located in your view. When you open a submenu, it hides a small part of the view, which is redrawn when the submenu is closed.
Where is the assert?
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
Ok, here is the line I am using in my CWinApp derived app, in the InitInstance, (AFTER the CSingleDocTemplate has loaded specifying the menu (IDR_MAINFRAME) AND after Show() has been called)
[ccode]
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CWinAppDoc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CWinAppView));
AddDocTemplate(pDocTemplate);
... code to determine that some menu items are to be disabled ...
m_pMainWnd->GetMenu()->GetSubMenu(0)->EnableMenuItem(i, MF_BYPOSITION|MF_GRAYED);
[/ccode]
That line 'works', but when I try to exand SubMenu 0 ('File') it blows up here:
[ccode]
_AFXWIN_INLINE UINT CMenu::GetMenuItemCount() const
{ ASSERT(::IsMenu(m_hMenu)); return ::GetMenuItemCount(m_hMenu); }
[/ccode]
Which is being called from: CFrameWnd::OnInitMenuPopup(CMenu * 0x00bf6b80 {CTempMenu}, unsigned int 0, int 0)
I think it's because the menu hasn't been init'ed but the calls to modify the menu don't fail.
|
|
|
|
|
Ok, I thin I've understood. It's not the good way to set menu item sensitivity. MFC framework uses another system, the "OnUpdateUI" mechanism.
Basically:
In the MainFrame (or View, as you wish) message map, add
ON_UPDATE_COMMAND_UI(ID_MYMENUCOMMAND, OnUpdateMyMenu)
Next, add the method
void CMainFrame::OnUpdateMyMenu(CCmdUI* pCmdUI)<br />
{<br />
pCmdUI->Enable(FALSE);
}
It's possible to do this using the ClassWizard.
You may find useful info on this mechanism on
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfc_ccmdui.asp
HTH,
K.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|
|
Thank you...
But so you're saying for each one [menu item] I have to create an entry and write a function?
Wow.
Thanks again.
|
|
|
|
|
There is a possibility to affect a method to a range of Ids, using the macro ON_UPDATE_COMMAND_UI_RANGE
(also, by default, menu items which have an associated command are enabled, menu items without command are disabled)
But mainly, yes, you have to. However, classWizard makes the task easier.
Angels banished from heaven have no choice but to become demons
Cowboy Bebop
|
|
|
|