|
No, I haven't set the TVS_SINGLEEXPAND. Here is the code:
if (!m_TreeCtrl.Create( WS_VISIBLE | WS_CHILD |
TVS_HASBUTTONS | // Adds a button to the left of each parent item.
TVS_HASLINES | // Has lines linking child items
// to their corresponding parent items.
TVS_LINESATROOT | // Has lines linking child items to
// the root of the hierarchy.
TVS_EDITLABELS | // Allows users to edit the labels of tree view items.
TVS_SHOWSELALWAYS,// Causes a selected item to remain selected when
// the tree-view control loses focus.
rc,
this,
0x1005 ) )
Thank you!
|
|
|
|
|
Hi,
I am new to MFC and work on a physical simulation application. I am a bit insecure on how to build up the program and would be thankful for any advise.
The simulation shall be updated as often as possible. The update of the simulation then affects the viewing data (vertices and polygons etc) displayed using OpenGL. The framerate of the viewupdate shall be fixed to around 12/sek.
1.Where is best, most natural, to put the simulationupdate-call? Is it in a CWinApp derived class´s Idle-Event-handler? In that case, how do I get a pointer to the CDocument-derived class that holds the simulation-data?
2.Where is best to put the view-update-call, i.e the call that updates the viewing data and then redraws the display-window? Is it in a timer-event of a CView derived class?
Thanks/JoNy
JoNy
|
|
|
|
|
The simulation shall be updated as often as possible.
This leaves only one option: put the simultation-update code into separate worker thread.
The framerate of the viewupdate shall be fixed to around 12/sek.
Isn't it contradictory with previous requirement? I mean, if you're going to display 12 frames per second, why do you need maximum speed in the data-update code?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks,
no it is not contradictory since I am not interested in sync between physical simulation and the view of it. If the simulation iterates 100 times/sek and the view of it 12 times/sek that means that the action (i.e every tiny little change)occurs faster than what is possible to show. But the thing with physical simulations is that it has to take all those small steps to reach a certain point.
How do I create separate worker threads? Are there any good articles on it?
Thanks again /JoNy
|
|
|
|
|
How do I create separate worker threads?
AfxBeginThread in MFC, _beginthread, _beginthreadex in C/C++ Runtime library. There's also CreateThread if you're playing directly with Win32 API, but it's not recommended if your thread use standard C/C++ functions (they need to be initialized on per-thread basis; CreateThread is a Windows function that doesn't know anything about C/C++ library).
search for these function names, I'm sure MSDN has lot of multithreading samples. Here at CodeProject look at 'Threads, Processes and IPC' section.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
hi, hav'n problems in making 2 processes to communicate with each other .. actually 1 of these invokes the other using CreateProcesss and thne when i try to senda message it is not captured by the other (child) process ..... need guidance or maybe some alternative to achieve this ....
thanks in advance ... :
|
|
|
|
|
Hi !
You can use old things that work quite right, "Memory File Mapping" or "Named pipes", there you open a file in memory and you send that to the other proccess, quite fast and quite good for simple communication.
But... If you want something more complex, you can use COM, and use a Sink interface.
If you need more help, please ask me, Bye !
Braulio
|
|
|
|
|
I want App A to Tell App B to do something.
i.e. I want the 2 processes to communicate. App A and App B are both written by me so I can make modifications ot the code if required. can anyone help.
Maliha
|
|
|
|
|
There are several IPC (inter-process communication) methods. If you only need to transfer a simple block of data, WM_COPYDATA should work fine. Check out the Threads & IPC section here at CodeProject for more.
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
I tried using WM_COPYDATA. But there is a problem:
You need a handle to the destination Window. Where do I get that? How do I know what the handle of the window in another process is? I tried using HWND_BROADCAST but then other applications started to catch the message and crashed. (Outlook.exe crashed and so did explorer)
|
|
|
|
|
You can enumerate all the windows on the system - if you know the class name or the caption, you can figure out which is the right one.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
What 's a best directX book I can read !
I 'm a beginer of directX
I focus about directMusic & directShow
thanks
|
|
|
|
|
Hi all,
I am new to C++ and I have to say my biggest hurdle is getting my head around what operations I can do with the various var types. It seems everytime I try and do anything with a CString I get an error telling my 'can't convert CString to char *' or various errors all along these lines.
Anyway I think I am starting to get there
I need to extract a substring from a CString.
i.e.
CString = "This is a test string"
say i need to get the word test out and store it in an word array.
I know what position it starts and i know what position it ends, so I of course know how many chars I need.
What should I use to get that word from the CString and stick it in
say word_array[word_count]???
Any pointers are greatly appreciated,
Cheers Dudes,
Tryhard
Down Under
PS - Thanks to all who have replied to my previous posts
esp. C.G. Thanks Dude, very helpfull
Tryhard
|
|
|
|
|
To get a substring out of a CString you can use left, mid, or right. For example, in the above example you could use
CString s = "This is a test string";
CString y = s.Mid(10, 4);
As usual, you can use SetBuffer and ReleaseBuffer in order to get the underlying data if you need to.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I WANT TO INSERT A MICROSOFT LISTVIEW6.0 IN MY HTML PAGE,SO I CAN INITIALIZE IT WITH DATABASE DATA,AND I CAN GET USER'S SELECTION,HOW CAN I DO???
|
|
|
|
|
STOP SHOUTING
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Sorry for shouting,but can you help me?
|
|
|
|
|
Sorry, no. I'm not sure this is the right forum, I doubt it's a C++ question.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
Hey,
Could any one please tell me any idea on how can i solve this problem. I made a list box in which files can be added and can also be zipped. However, all of this is done in a while loop so the dialog isn't receivng any messages, kind of freezing until the loop is done. I would like to be able to click Cancel but it's not working. I tried inserting this in the middle of the loop:
CWinApp* pApp = AfxGetApp();
MSG msg;
while ( PeekMessage ( &msg, NULL, 0, 0, PM_NOREMOVE ))
pApp->PumpMessage();
but it makes it a lot slower and while the files are being zipped this won't work.
I created a worker thread but the problem is that i need to call functions like:
next = m_files.GetNextItem(next-1 ,LVNI_SELECTED );
which are non static so the compiler will give me an error. It won't work either with GUI thread. Any suggesions on how to fix this?
Thanks alot.
Regards,
Eric
|
|
|
|
|
Pass the HWND of the list control to your worker thread. You can then use the straight APIs to access the list (sending messages is safe between threads in the same process), or make a local CListCtrl variable and attach it to the window handle, if you prefer using CListCtrl methods.
UINT ThreadProc(void* pv)
{
CListCtrl list;
list.Attach ( (HWND) pv );
list.Detach();
return retcode;
}
--Mike--
http://home.inreach.com/mdunn/
Trillian: What are you supposed to do with a manically depressed robot?
Marvin: You think you've got problems. What are you supposed to do if you are a manically depressed robot?
|
|
|
|
|
Hey Michael, thanks a lot for replying. I'll try that. Thanks again.
|
|
|
|
|
How can i read RGB (0...255) data from Bitmap for each pixel?
|
|
|
|
|
Do you mean Bitmap (GDI+) or CBitmap (MFC) or HBITMAP (Win32) ?
MFC has GetPixel/SetPixel. You can select a bitmap into a DC and then use those. If you meant something else, just say.
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|
|
I posted this elsewhere with no response, hopefully here it will see more action.
Alright, first, a quick explaination of my problem.
I make a piece of software that the company i work for uses to control logons to a computer. It is a computer rental place, and upon timing out the login screen has to pop up to the top of ANYTHING that could be running and stay there.
I have it running in Windows 9X, and is quite secure. I hide it from Control Alt Del menu right off the bat, and on the login screen i press it to the front with a collection of APIs called many times a second.
But we are considering moving to windows XP. Its task manager can see (and end) my process at any time, regardless of any API i have seen so far. Task manager cant stay in front of the login screen, but when someone logs in (the login screen goes away) they can simply end the task for the software!
Not Good!
So, I've been reading up on how this all works, and I have a couple ideas on how to fix it but no idea how to approach any of them.
#1: Run the program under alternate credentials. This WORKS (access denied trying to end my task), but damit, have to enter the password every time (very bad, many computers). Anyone know how to start a task under alternate credentials and have it start automatically? this would solve the problem, and i think it would be best. Storing the password in a batch file in plain text is NOT an option. some of our users are fairly good with computers.
#2: Run a stub-service that that checks for status of my login program, and starts it again if it disapears. Since the users will be low-access and the service runs under ./SYSTEM, it can't be stoped. so if anyone kills the task they will be greeted with the login screen when it starts back up. This would also work, but i have no idea how services work.
#3: Find an API that lets me once again hide the task completely like 9x. I dont like this at all, but if its the only way it will have to do.
#4: Any other sugestions?
Can anyone reccommend anything that would help me on this problem? we can keep using 9x for a while, but it would be nice to have XP in order to start pimping it when it hits the streets. That means i have to start working on it now to have it on systems by the 25th of oct.
// Rock
|
|
|
|
|
Can you place your code inside a service? Service process is visible in the task manager, but user can't kill it. If service runs on 'Local System' account, there's no need to enter the password. And even if you choose to run under different account, the password is stored in the services database - there will be no login dialog.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|