|
I wanna implement magnetic effect to ControlBar.
So, I override OnWindowPosChanging() member function.
But WM_WINDOWPOSCHANGING Message did not enter.
that is, the message entered to CMiniDockFrameWnd, but
did not ControlBar class.
I want another method...
thanks for read this message...
|
|
|
|
|
I suppose you want to implement the "magnetic" effect for the floating bars, because the docked ones already snap to the dockbars.
Well, you guessed right - CMiniDockFrameWnd is the best place to do this. You can derive your own floating miniframe class from CMiniDockFrameWnd and register it by setting the CMainFrame's m_pFloatingFrameClass right after you call EnableDocking() for the main frame (usually in OnCreate()) :
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
//...
EnableDocking(CBRS_ALIGN_ANY);
m_pFloatingFrameClass = RUNTIME_CLASS(CMyMiniDockFrameWnd);
//...
}
|
|
|
|
|
Hi,
I want to execute dos commands from my app, such as "dir", or "copy".
Sorry if this is a "stupid" question...and yes, I did RTFM.
**FOLLOW UP AND ANSWER**
Found the best way to do this from a Win32 app is:
WinExec ( "cmd.exe /c doscommand /switch parameters", SW_HIDE )
By doing cmd.exe the next command is executed in a new process and the cmd.exe window will close after execution. Also, by using WinExec, you get the added benefit of hiding the MS-DOS window.
Thanks for everyone's suggestions and help!
|
|
|
|
|
One Way is This
UINT WinExec(
LPCSTR lpCmdLine, // address of command line
UINT uCmdShow // window style for new application
);
|
|
|
|
|
Unfortunately, I've tried this and it doesn't expose the dos commands available at the Ms-dos prompt, such as dir, copy, etc. Thanks for your reply.
|
|
|
|
|
Did you try ShellExecute or ShellExecuteEx?
|
|
|
|
|
Tried that and it doesn't work. I've tried executing cmd.exe (nt) with dir as a parameter, and that doesn't work either. Any other ideas?
|
|
|
|
|
cmd.exe has number of switches you have to use in order to make it execute a DOS command. For example:
cmd.exe /c dir
This will execute dir and will close dos window.
cmd.exe /k dir
This will execute dir and will dos window will remain open.
I hope this helps.
|
|
|
|
|
void CTestDirDlg::OnButton1()
{
STARTUPINFO startInfo;
PROCESS_INFORMATION procInfo;
startInfo.cb = sizeof(STARTUPINFO);
startInfo.lpReserved = NULL;
startInfo.lpTitle = NULL;
startInfo.lpDesktop = NULL;
startInfo.dwX = startInfo.dwY = startInfo.dwYSize = startInfo.dwXSize = 0;
startInfo.dwFlags = STARTF_USESHOWWINDOW;
startInfo.hStdInput = NULL;
startInfo.hStdOutput = NULL;
startInfo.hStdError = NULL;
startInfo.wShowWindow = SW_SHOW;
startInfo.lpReserved2 = NULL;
startInfo.cbReserved2 = NULL;
if (!CreateProcess ( NULL,
"c:\\command.com /k dir",
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS,
NULL,
NULL,
&startInfo,
&procInfo
))
{
int err = GetLastError();
}
}
You can play with this a bit - the next thing to add is
the mechanism for passing the stdin, out, and error handles so that you can get the results...
|
|
|
|
|
#include <stdlib.h>
system("dir C:\\windows");
Bam, there ya go.
|
|
|
|
|
Does anybody know as how to migrate my projects from
visual C++ to Borland C++. Does Borland C++ builder include
Foundation Classes like MFC??
|
|
|
|
|
Yes, BCB 4 has what seems to be the version of MFC that shipped with VC 5.0 (may be updates), and can convert a VC 6 project.
I tried the Visual C++ Project Conversion Utility from the Tools menu, and converted a VC6 project (The Wizard2000 demo, available here) - or rather one build configuration.
The build balked only once, at #include <afxdtctl.h>, which is new to VC6.
You might be slightly better off moving the projects back
to VC5 before conversion - or at least setting the debug info settings back a notch to 'Program database' from 'Program database for edit and continue' but since (I think) you basically work with a single config in BCB this may not be an issue - you can edit these in BCB.
Tim
|
|
|
|
|
Does anybody knows about Borland C++ site just like "Code Tools".
I will appreciate response from readers
|
|
|
|
|
Hey James,
Why don't you talk to Chris about you starting one as part of CodeProject? (this site btw is codeproject.com)
I'm not a big Borland C++ guy, but I can't see how it would be that tough to open a forum for BC questions, and make a place to post BC code examples.
|
|
|
|
|
Adding a Borland C++ forum is a piece of cake - but how many people would use it?
|
|
|
|
|
In trying to manage PCH effectively on a large project and keeping track of and minimizing dependencies, I've often wanted a good tool for viewing the include tree of a file.
An ideal thing would be a add-in, you hit a button, it pops up a tree-view of the all included files (direct or indirect).
Anyone seen anything remotely like this?
-Philip
|
|
|
|
|
I know this is not what you are looking for, but might be a possible source of info.
I used the message pragma to instrument four headers of a simple dialog app with:
#if defined(SHOW_DEPENDANCIES)
#pragma message(" testDir.h included\n")
#endif
Then did a rebuild all -
Compiling resources...
Compiling...
StdAfx.cpp
stdafx.h included
Compiling...
TestDir.cpp
TestDirDlg.cpp
testDir.h included
resource.h included
TestDirDlg.h included
Generating Code...
testDir.h included
resource.h included
TestDirDlg.h included
Linking...
Seems to show that stdafx.h is included only once for all translation units, but the output seems staggered somehow... hmmm - perhaps compilation is multi-threaded in some way - maybe the preprocessor is spawned separately.
Would this effectvely track PCH usage during rebuilds?
You would think a compiler could offer some sort of 'verbose' switch to do this for us.
|
|
|
|
|
Your output is correct, because with PCH stdafx.h is read only once. There is no multi-threaded compilation, sadly, except in the sense the rest of MSDEV stays usable while you are compiling.
Your idea would be a start, but for a large project you need to represent the output as a tree somehow, not just a list of what is included, in order to make sense of it.
I saw some add-in that claimed to do this a while ago, and some of the "code browsers" claim to, but I've never gotten any of them to work for me.
-Philip
|
|
|
|
|
Hello gurus,
I am trying to develop a dll which will add a window to IE same as Web Search Assistant. Any ideas? I cant use Frames.
regards,
Mahesh
|
|
|
|
|
The web search assistant is a Deskband object that is registered under IE. You can create your own by implementing a COM object that supports IDeskband and a few other interfaces, or you can use the wizard I created under the ATL section of CodeProject for creating Deskbands.
Let me know if you have any development questions, I have done quite a few of these.
|
|
|
|
|
Can anyone tell me how to open a main menu programmatically?
In my main frame class of an MFC MDI app I have a function (OnMenuChar) that needs to mimic the functionality of pressing Alt-F on the keyboard to open the File menu. I don't want to do anything other than that, such as open a file, just open the menu so the user can then make their own choice.
I have tried several things to no avail. I can get the system menu to open, but not the main menu.
Thanks in advance for any assistance!
Jim
|
|
|
|
|
Did you try HiliteMenuItem() function?
|
|
|
|
|
You can try the following
/* Pass the handle to the window
SetForegroundWindow(hwnd)
// Pass alt- f
keybd_event(VK_MENU,0,0,0);
keybd_event('F',0,0,0);
// Release alt
keybd_event (VK_MENU, 0,KEYEVENTF_KEYUP ,0)
Regards,
Renga.
|
|
|
|
|
i founded out that the CListCtrl class has a big big bug.
I inserted only one item without subitems in that way:
// CListCtrl e.g. OnMouseClick.....
LV_ITEM lv;
lv.mask ...... and so on
lv.iItem = 0;
lv.iSubItem = 0;
rc = InsertItem( &lv );
SetItemData( rc, (long)bitmask );
so the items will be inserted but the item data will be not
the same i have inserted. it will be every time i debug it
for the next item....
e.g.
normal:
item itemdata
0 123
1 321
2 132
3 213
not normal:
item itemdata
0 321
1 132
2 213
3 123
that's very bad...
but i solved it in this way...
i deselect the sort entry in the resource workshop....
note: you don't have any sort ( ascend / descend )
right is: none
best regards
ingo eberhardt
NOTE: plz do not send me any spam mails or advert.
|
|
|
|
|
I wrote a program that simulate Brower upload file to Web Server.This Program run well in the local network,But it is fail When it connect to outside Web Site through Local Proxy server.Proxy server send the program a response message,The status code of response message is 407.
I found that if i use the HttpSendRequestEx Function of wininet.dll then proxy can response 407 status code ,if i use the HttpSendRequest function of wininet.dll then proxy accept this request.I don't know what happen about it!
Who can tell me how to the solution of this issue!
Let me can use the HttpSendRequestEx funtion of wininet.dll
upload file to web server,But proxy cann't send 407 status code.
or
Tell me how to use the HttpSendRequest function of wininet.dll writeing a upload file program
Thanks you!
|
|
|
|