|
Thanks for your information
|
|
|
|
|
I created my own GUI, straight forward region box with a loaded bitmap,
i have question about setting a menu up for it, because menus sit under the title bar and atm its my own gui would i have to program my own menu or is there a way to move it down and resize it
|
|
|
|
|
Sarriss wrote: own gui would i have to program my own menu or is there a way to move it down and
yes.
I you create your own UI, you must be prepared to go all the way...
BUT, I've seen applications with custom UI that still use standard menubar and menu, and only show the menu on demand,
when the user's mouse pointer gets near where the menu should be.
|
|
|
|
|
so im wondering whether they created a GUI as a frame and stuck a frameless window in there which had the menu at the top maybe
|
|
|
|
|
I have a mask DC (dcFrom) that I want to rotate into another DC (dcTo);
Both DCs are monochrome. For example, dcFrom is all black, with a white ellipsed in the middle(ish).
I make a new DC, and set it all black. I do a PlgBlt, and I end up with a white circle in a black rectangle - but I also end up with some odd white artefacts around the edge.
Has anyone used PlgBlt with monochrome DCs before?
BOOL b = ::PlgBlt (*m_pDC, ptCorners, *pDCTmp, boundsOld.Shape.left - boundsOld.DC.left, boundsOld.Shape.top - boundsOld.DC.top, boundsOld.Shape.Width (), boundsOld.Shape.Height (), NULL, 0,0);
Iain.
|
|
|
|
|
Grrr me.
Had a flash of inspiration, and setting Text and Bk colours cured it.
m_pDC->SetTextColor (RGB(0,0,0));
m_pDC->SetBkColor (RGB(255,255,255));
pDCTmp->SetTextColor (RGB(0,0,0));
pDCTmp->SetBkColor (RGB(255,255,255));
BOOL b = ::PlgBlt (*m_pDC, ptCorners, *pDCTmp, boundsOld.Shape.left - boundsOld.DC.left, boundsOld.Shape.top - boundsOld.DC.top, boundsOld.Shape.Width (), boundsOld.Shape.Height (), NULL, 0,0);
Iain.
|
|
|
|
|
Hello,
I'm Giulio an Italian new MFC developer. I have a problem with the class CMFCPropertyGridProperty. I want to use the Color Palette generated by this class to retrieve a color value to use in my Drawcli like application. This is the code I write (this code is automatically generated by mfc wizard):
void CPropertiesWnd::InitPropList()
{
...
CMFCPropertyGridColorProperty* pColorProp = new CMFCPropertyGridColorProperty(_T
("Colore della finestra"), RGB(210, 192, 254), NULL, _T("Specifica il colore predefinito della finestra."));
pColorProp->EnableOtherButton(_T("Altro..."));
pColorProp->EnableAutomaticButton(_T("Predefinito"), ::GetSysColor(COLOR_3DFACE));
pGroup3->AddSubItem(pColorProp);
...
}
I want to use the color value retrieved by this menu as I can do with a dialog control. Could anyone help me?
|
|
|
|
|
Hi
Using the MS Example "How to create an automation project using MFC and a type library" to control MS Excel under MFC I get the error
Excel::_Application cannot instantiate abstract class
using the following code
void CAutoProjectDlg::OnRun()<br />
{<br />
_Application app;
<br />
if(!app.CreateDispatch("Excel.Application"))<br />
{<br />
AfxMessageBox("Couldn't start Excel.");<br />
}<br />
else<br />
{<br />
app.SetVisible(TRUE);<br />
AfxMessageBox ("Excel is Running!");<br />
}<br />
}<br />
How should I overcome this error ?
Regards,
sdancer75
|
|
|
|
|
Well, the error gives you a lot of information.
I'm assuming _Application is the Excel interface. An interface is pretty much just a C++ class with all the methods abstract. So you can't create it directly.
I suggest you search for examples, and look for CoCreateInstance, or CoCreateInstanceEx.
Under Platforms, Frameworks & Libraries on CP, there is a COM category - there are several good tutorials there. They may not clue you in on excel, but they will give you the COM concepts you need.
Iain.
|
|
|
|
|
Thanks Iain,
I wonder why the heck Microsoft publish an example in their web site, when it does not applying in the real world practice.
Anyway, In my case, either the intellisense system works so, I have to find out the methods that this interface hosts, by manual.
Am I doing something wrong in my initial setup ?
I am using VS2008 pro and I want to create a skill test application for the MS Office. Is that too much complicated in MFC ?
Should I leap to Visual Basic instead?
Regards,
sdancer75
|
|
|
|
|
I like C++ for my main programming needs, but what little I know of VB, is that it eats IDispatch for breakfast, then burts delicately into a napkin. Don;t write device drivers in it, or software that talks to device drivers (liem I do), or... But for working with automation etc, it will serve you well.
This is from someone who knows a bunch about C++, and a smidgeon about VB, so take this advice with a pinch of salt.
Iain.
|
|
|
|
|
Hi all..
I've one dialog box which i'm moving up from taskbar(Just like popup or bubble dialog or notification)... This is done by getting coordinates and putting SetWindowPos in loop(Tried AnimateWindow() but it's not compatible in NT)...
Now i've some buttons on that dialog.. The problem is that while dialog moves the buttons keeps hidden and only shows when dialog stops after moving.. I want to show buttons moving along with the dialog.... Any idea??
Thanks..
|
|
|
|
|
|
Is this code in the application itself? I suspect it is, and it's in a loop like:
void HandleTheTaskMessageAskingMeToComeBackFromTheDead ()
{
for (int n = 0; n < 100; n++)
{
SetWindowPos (hMyWnd, NULL,0,0, n,n, SWP_NOMOVE | SWP_NORESIZE);
Sleep (10);
}
}
(parameters from memory)
[modded here - posted instead of previewing! ]
In which case, the SetWindowPos invalidates your window, but you don't process any messages, so your dialog never gets any WM_PAINTs until you're done with animation.
That's my guess going on the information you've given.
On another note...
Unless you have a compelling argument for it, I hate slow reveals. I've clicked and asked for your dialog, so I want it NOW DAMMIT! If I wanted it later, I'd ask later.
Iain.
|
|
|
|
|
It's something like this..
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
}
Sorry but do we have "SWP_NORESIZE" Flag in SetWindowPos???
And no i'm not handling any messages..Just need to pop up my dialog from task bar along with all the controls
|
|
|
|
|
I did tell you it was from memory. You've proven my point - you have a loop, a setwindowpos, and a sleep.
Nowhere do you handle messages in the message queue.
SetWindowPos will generate WM_SIZE, WM_MOVE, etc, which in turn invalidate your window, which ends up doing WM_PAINT. So, no painting of contents.
I AM PSYCHIC!
Try the following:
for(;thisWindowRect.top > SlideDialog.top- 164; thisWindowRect.top--)
{
SetWindowPos(hWnd, NULL,thisWindowRect.left, thisWindowRect.top, 0, 0, SWP_NOSIZE);
Sleep(20);
UpdateWindow (hWnd);
}
This should redraw the dialog window. It might not redraw any child controls, in which case you are going to have to rethink your design.
If AnimateWindow does not work under windows NT, then don't use it. Try using LoadLibrary to attempt the function. If it fails, then take that as a hint to skip the whole animation process entirely. You users of old OS's will thank you for it.
Iain.
|
|
|
|
|
Wow Iain you must have a full charged CPMRU 's battery pack!
My 5 .
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]
|
|
|
|
|
Hello everybody,
I am trying to change working directory in c++, For example: My programs is in c://work, I run the program from there, but during running this program, I have to change working directory, do something there.I tried to do it like this:
system("cd c:/work/test"); but it does not change working directory
Is there a way to change current working directory in c/c++?
Thanks in advance
It is never late to learn
|
|
|
|
|
chdir is the function you should use. as for what you tried it works in the sense that cmd.exe which is started as a child process whenever you call system() changes its working directory.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
chdir is c/c++ function? or shell function?
can i use it like
system("chdir c:/work/test");
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: can i use it like
system("chdir c:/work/test");
Yes, with the same result you got before.
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]
|
|
|
|
|
_chdir [^].
SetCurrentDirectory [^].
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]
|
|
|
|
|
Actually, I am using GNU c compiler for UNIX, it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
It is never late to learn
|
|
|
|
|
Gofur Halmurat wrote: I am using GNU c compiler for UNIX
GNU isn't for Linux (after all "G nu is N ot U nix" )?
Gofur Halmurat wrote: it seems chdir and SetCurrentDirectory for windows only, is there any other way for UNIX?
chdir should be available on any POSIX compliant system, like GNU/Linux .
Are you aware that CodeProject has a Linux forum?
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]
|
|
|
|
|
Did you use if these functions and what was result?
|
|
|
|
|