|
i downloaded SCBDemo3, a sample or library of dockable window.
in my program, i modified it, but i meet unknown trouble with it. please help ....
first, create a sub-class of the dockable window (called XDock).
then add a CView's sub-class (called XView) as its content (or RUNTIME CLASS, or child), then add 3 CTreeCtrl's sub-class (called XTree) as children of XView.
then add some tree items on WM_CREATE message of XTree(OnCreate) to each tree.
------------ so far so good. but problem comes now:
i can not add a tree item out of XDock !
code is simplified as:
class XView:public CView
{.........
CTreeCtrl tree0,tree1,tree2;
.........
};
XDock dock;
dock.Create(this,RUNTIME_CLASS(XView),....
//tree0,1,2 are created inside XView
//add tree items inside tree0, OK
problem is add tree item out of dock as following:
XView*pv=(XView*)dock.GetWindow(GW_CHILD);
pv->tree0.AddTreeItem("some name");//a. retuen 0.
BOOL XTree::AddTreeItem(CString cs)
{
HTREEITEM hNew=InsertItem(........);//b. hNew is 0
......
};
note: as i said, if inside XTree, it is OK
BOOL XTree::OnCreate(...)
{..............
AddTreeItem("it is OK here");
}
i checked both a. and b. are called, why calling inside XTree is OK, outside is failed?
i'm waiting for u and prepare more hints as required.
thx
includeh10
|
|
|
|
|
My Project:
To prepare a master data file from numerous text files (3,00 to 8,000).
Each file has a unique name.
The first line of each file is NOT a header file.
- The first line of each file needs to be concantonated to each of the following lines of the respective file.
- Then the first line needs to be deleted
Then the file needs to be appended to a master file.
I want to auto mate this process to automatically perform this to all the files selected ( all the selected file will be in one directory)
Okay, I started this project in MS ACCESS but I can only process one file at a time. So I thought I would dabble with trying to figure this out in a programming language. I am vaugley familiar with VB and intermediate (or a bit less) using BASIC. Any help would be appreciated.
Fred
|
|
|
|
|
This is a snap using iostreams in C++, but based on what you've said, I'm not sure that there is any starting point from which to discuss it. Have you used C++ before ? If not, why are you posting to a C++ forum ?
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
I have the following problem. I want to use WinNT functions in a program that should work on Win9x too. I have a single .exe. I check the OS version before calling the NT only functions but when I try to run the program under Win9x it get an error that the .exe is linked to a missing export in user32.dll.
I am relatively new to Windows and this is the first program I'm trying to do Win9x compatable.
Do you have any idea what do I miss?
With the new unicows.dll I should even be able to write a single UNICODE application for Win9x and WinNT.
|
|
|
|
|
You need to delay load the dll that has the function you only have available in NT, otherwise it will not run, even if it's not getting called in 9x. I forget how, but it's in the MSDN.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Christian Graus wrote:
You need to delay load the dll
... or call GetProcAddress for the "extended" functions.
|
|
|
|
|
In the MSVC documentation, SetActivateWindow() activates a window - however this must be associated with the calling thread's message queue. Is there a way that I can pass control from my program to another app's main window knowing it's handle ?? (I have got the handle using EnumWindows() and checking the window title). Appreciate any help
Doug
|
|
|
|
|
ummmm this might be dumb but cant you send a mouse click message to its message queue ... that would make the whole thing happen as if the user clicked it
just a thought
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
|
doh!
i knew there would be an easy way
i was too lazy to squizz thru the msdn stuff
sorry
"... and so i said to him ... if it don't dance (or code) and you can't eat it either f**k it or throw it away" sonork: 100.18128 8028finder.com
|
|
|
|
|
lauren wrote:
i knew there would be an easy way
Sadly under 2K and XP, it won't actually make it foreground
It'll just flash the taskbar icon thrice. Unless you change this setting using Powertoys. Something about preventing apps from stealing focus.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Before calling SetActiveWindow, use the AttachThreadInput function to attach the input states of the calling thread and the thread with the desired window:
DWORD tidThis,tidOther;
tidThis=GetCurrentThreadId();
tidOther=GetWindowThreadProcessId(hwnd,NULL);
if(tidThis!=tidOther)
AttachThreadInput(tidThis,tidOther,TRUE);
SetActiveWindow(hwnd);
if(tidThis!=tidOther)
AttachThreadInput(tidThis,tidOther,FALSE);
Peter O.
|
|
|
|
|
Peter, that code works a treat !! Many thanks for your help - I've learnt something ! Thanks also to all the others who contributed to this thread.
Doug
|
|
|
|
|
Hi,
I'm a complete newcomer to Visual C++, and have just downloaded the MFCGridCtrl component from this site. My question is simple - I've included the files into my project in VC++6, but how do I place an instance of the MFCGridCtrl onto my dialog? Please explain how to do this step-by-step, assuming I have just downloaded the source code files...
Thanks a lot for any help on such a dumb question,
Jonathan.
|
|
|
|
|
Did you get the demo program? If not, download it too, then look to see how it was implemented. You might also compile the demo for debug then step through some of the demo program to see how it works.
|
|
|
|
|
Hi,
Thanks for your reply, but I'm afraid it hasn't helped me much...my problem is not actually USING the control once it is in my application, but actually getting it into my app in the first place. Its not a problem specific to this control, just a general procedure I guess.
I've programmed in Delphi, where importing 3rd party components and placing them on a form is easy...it seems a bit less obvious in visual c++?? I thought I would just be able to drag and drop the control onto a dialog the same as an edit box, for example, but obviously not...
Jonathan.
|
|
|
|
|
hi!
sorry i come here for help, not help u.
i can't find site u said to download MFCGridCtrl, could u post its address? it looks interesting.
thx
includeh10
|
|
|
|
|
|
First you have to register the control on your computer. cd to the folder that contains the control, then enter "regsvr32 -r mycontrol.ocx" <enter> If it an ActiveX control it will most likely have an "ocx" extension. Otherwise it may have a "dll" extension.
Once registered, you can add it to your VC6 project by doing this:
1. Select Project | Add To Project | Conponents and Control
2. In the dialog box that appears, you will probably see two folders: "Registered Active X Controls" and "Visual C++ Components". Double click on "Registeredd Active X Aontrols".
3. This will bring up a list of all the ActiveX control that are registered on your computer. Highlight the control you want, then press the "Insert" button. I use MSFlexGrid control a lot, but the cells cannot be edited.
4. When "Insert the Component?" prompt appears, click the Ok button.
5. When the "Confirm Class" dialog box appears, use the default settings and just press the Ok button.
6. At this point, you can add other controls if you want to. When you are done, press the "close" button.
Now you can drag the control onto your form.
|
|
|
|
|
Nice one - it was the registering the control using "regsvr32 -r mycontrol.ocx" that I was missing.
Thanks a lot,
Jonathan.
|
|
|
|
|
Place a custom control in the dialog and give its resource id in the DoDataExchange function of the dialog class.
You can find that code in the DoDataExchange function from the code you have downloaded.The grid will be visible if sone rows ans columns are set,otherwise it will tell "failed to create document".All the best.
munafmohamed
|
|
|
|
|
Place a custom control in the dialog and give its resource id in the DoDataExchange function of the dialog class.
You can find that code in the DoDataExchange function from the code you have downloaded.The grid will be visible if sone rows ans columns are set,otherwise it will tell "failed to create document".All the best.
munafmohamed
|
|
|
|
|
well I don't know much about internet programming
but I need my application to do some action when the user connects to the internet
in other words
* while the pragram is running
when connected fire some event(or simply call afunction)
when connection terminated do othe action
thanks for your time
|
|
|
|
|
This function determines whether the user is connected to at least one RAS connection. Link with rasapi32.lib.
You can use this function to start your program.
#include <windows.h>
#include <ras.h>
BOOL IsUserConnected(){
RASCONN *rasc=malloc(1000);
DWORD bs,nc,i,j,dwRet;
RASCONNSTATUS rcs;
MSG msg;
TCHAR s[257];
rcs.dwSize=160;
rasc->dwSize=412;
dwRet=RasEnumConnections(rasc,&bs,&nc);
if(!bs)return 0;
rasc=realloc(rasc,bs);
if(RasEnumConnections(rasc,&bs,&nc))
return 0;
for(i=0;i<bs/412;i++){
HRASCONN hrc=rasc[i].hrasconn;
dwRet = RasGetConnectStatus(hrc, &rcs);
if (dwRet != ERROR_INVALID_HANDLE)
continue;
if (dwRet != ERROR_NOT_ENOUGH_MEMORY){
SetLastError(dwRet);
return 0;
}
if(rcs.rasconnstate==RASCS_Connected)
return 1;
}
return 0;
}
Peter O.
|
|
|
|
|
Also see InternetGetConnectedState() . You can call it in a timer handler and fire events when the connection state changes.
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|