|
the program will be up-loaded and down-loaded very often.
includeh10
|
|
|
|
|
Hi,
I have a problem with sorting duplicate items in a treeview.
I retrive some info from a database and the resultset look something like this :
Date....|City.....|Code
---------------------------
20041012|London...|123
20041012|London...|456
20041012|New York.|763
20041013|Boston...|236
20041013|London...|983
20041012|Oslo.....|923
And I want the treeview to look like this :
+20041012
...+London
......+123
......+456
...+New York
......+763
...+Oslo
......+923
+20041013
...+Boston
......+236
...+London
......+983
How can i put the correct nodes in the correct level and do this in a easy way?
Tune In, Turn On, Drop Out
|
|
|
|
|
tree-view has a sorting function, it is good enough for your case.
includeh10
|
|
|
|
|
HTREEITEM htiParent = m_pTreeCtrl->InsertItem (strTreeItems[0]);
HTREEITEM htiChild; // child item
htiChild = m_pTreeCtrl->InsertItem (strTreeItems[1], 1, 1, htiParent, TVI_LAST);
m_pTreeCtrl->SetItemState (htiChild, TVIS_BOLD, TVIS_BOLD);
// add the children of the parent item
for (int i = 1; i < 4; i++) {
m_pTreeCtrl->InsertItem (strTreeItems[2], 2, 3, htiChild, TVI_LAST);
}
the code works as you wish, strTreeItems[x] is the Itemtext, that's looks like
+strTreeItems[0]
++strTreeItems[1]
+++strTreeItems[2]
+++strTreeItems[2]
+++strTreeItems[2]
+++strTreeItems[2]
you can do it yourself i think~~~~~~~~~enjoy
cheer up!!!!!
|
|
|
|
|
I want to invoke ON_BN_CLICKED event of a button named bn_test manually from my code. Is there any possibility to invoke in this way?
|
|
|
|
|
if the button has an unique ID, i think you can add it as code auto generated by MFC.
includeh10
|
|
|
|
|
Why not just call the handler function directly?
BEGIN_MESSAGE_MAP(COptionsGeneralPage, CPropertyPage)
ON_BN_CLICKED(IDC_XB_ODBC_ENABLED, OnXbOdbcEnabled)
END_MESSAGE_MAP()
...
OnXbOdbcEnabled();
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
just post the wm_command event to the window with the id of the button
-prakash
|
|
|
|
|
|
I am creating a project which needs to skin a slidder control.This skin should be of .PNG file.How can i load image using the path of image file insted of Resource ID or name. I have seen article by JON "Skin based slider control Mark 2" but this is to load bmp file and by resource ID.
Pls help me
Learner always
|
|
|
|
|
Resizing the static control at runtime depending on the dynamic text.This shud increase or decrease the height to accomodate the text.And text shud wrap up.
Can anybody help plz.
|
|
|
|
|
use CDC to get size of your text then determine width and height of static control, i think there is no simple (or auto) way to do that.
includeh10
|
|
|
|
|
Hi I have two seperate exe files (both console applications) and I am looking for some ideas as to how I can deterimine if the other one is running so I can set the other one to sleep. Any help would be most appreciated
|
|
|
|
|
there is one C++ sample in article section of the forum, it is very good about running single copy program - exe file can not multiplely run - the sample detects if the exe (itself in the sample) is running.
you can modify the sample for detecting if another exe is running.
try to search it, the sample uses Mapping file.
includeh10
|
|
|
|
|
you can do it in many different ways.
one would be mutex objects which can be most efficient.
in one of the prg which will run first the fiorst line should be;
CreateMutex(NULL,TRUE,"Runnig");
now the second prg;
should enter in a cycle
while(CreateMutex(NULL,TRUE,"Running")!=ERROR_ALREADY_EXISTS)
{
Sleep(1);
}
or the other way around.
Try it
gabby
|
|
|
|
|
Thanks for the sugestions I am current executing the second file using this
WinExec("Application.exe",SW_SHOWMAXIMIZED);
Is there any other way I can check to see if its running without using Mutex as I have had lots of problems with them in the past
|
|
|
|
|
Check this out in MSDN:
Platform SDK: Performance Monitoring : Enumerating All Processes
|
|
|
|
|
HocusPocus235 wrote:
WinExec("Application.exe",SW_SHOWMAXIMIZED);
As WinExec() is for use with 16-bit Windows, why not use CreateProcess() instead?
STARTUPINFO si = {0};
PROCESS_INFORMATION pi = {0};
si.cb = sizeof(si);
CreateProcess(NULL, "Application.exe", ..., &si, &pi); Now when you want to know about the process, just look at pi.hProcess .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks for the sugestions people CreateProcess worked a charm
|
|
|
|
|
well..... ihad done this a different way.....
u c .....windows cannot delete a file when itz running.....use that concept.....
first make extra copies(backup) of the exe in a different location.....suppose the file that u want to check is not running,and u check this by trying to delete this file using the other running application,if success in deleteing the file then the file that u were checking was not running,else if it couldnt delete it,it meanz itz running.....now suppose it wasnt running and by checking this file if itz running or not(by trying to delete method),the file getz deleted,so now replace the backup exe to the same location.....
thatz the idea,i used in one of my programz.....
(might soung stupid.....but it workz fine).....
hope this info helpz.....
Happy programmin....
cheerz.....
|
|
|
|
|
Enumerating the running processes is as easy and a hell of a lot safer.
You also can not delete an executable if it is read only!!
I would *NOT* recommend that people try to determine if executables are running in this way.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
well.....(just a suggestion;))afterall it workz!!!!!.....thanx for correcting me.....
Happy programmin bro.....
cheerz.....
|
|
|
|
|
In some instances, working is merely a symptom of the output. Many things might appear to produce a correct result but that does not mean they are correct.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
Look the MSDN documentation for following API's and structs
PROCESSENTRY32 struct and api's like CreateToolhelp32Snapshot,
Process32First,Process32Next etc.
you can use these set of api's to check the exe is running or not !
If you have patients wait for some days, i m putting the artical on this
issue !
Regards,
Vishal
|
|
|
|
|
I should create the dialog window (mfc) when hot key is pressed. All works fine, but at first time the dialog creates with a small delay and instantly later. How to speed up it first creation?
Thanks.
|
|
|
|