|
Is there a way to select a line (drawn by LineTo or points -SetPixel) say by mouse either by clicking on it or by CRectTracker .. I have found a way which is very long, and I think there is a better way, if you got an idea please help me.
Thanks for reading. Neda
|
|
|
|
|
Hi Neda, Chetovri!
1- Are you using any collection or data structures when you draw the line?
2- Are you drwaing the new lines with the C++ new operator?
If Yes to (1), then you must have some sort of collection class to collect the new instances of the lines.
If Yes to (2), then you can just return the index of your line from the collection class.
|
|
|
|
|
Does anyone have any recommendations on whether to use ODBC or OLE DB in a C++ project? What are the pros and cons of using either one? From what I've been reading, it sounded like OLE DB would allow you to access everything ODBC will, but also allow you access to other data sources as well. However, am wondering how portable OLE DB is compared to ODBC and what other issues may suggest using one access method over the other.
Comments and suggestions appreciated. Thanks.
|
|
|
|
|
In one and I have a programs navigator (a kind of database). In the other hand I have an editor.
both created by myself using visual C++6.
I have decided to implement them separately in order to be able of make them better separately too.
In one button click of the semi-database I create a process calling CreateProcess(). And calling the editor App.
This has to be implemented in a machine, and I need the insurance that the Database app. don't continue working while the editor is not closed.
I have used WaitForSingleObject(Thread_of_the_editor_process,INFINITE); but the key and mouse events are still active, and when I close the editor app. they work as if the app won't be locked.
Could you give me an idea about how to implement a solution?
Thank you in advance.
|
|
|
|
|
Is this too simple ?
BeginWaitCursor();
..........
......... Sleep(SOME_TIME_LONG); // well you know what I mean
..........
..// Do the logic
EndWaitCursor(); // remove the hourglass cursor
Cheers
Alfadhly
|
|
|
|
|
Yes I know what you mean, but this is not effective in my situation: I need to wait until another application has finished, if I work in this way I will need to sleep some time, look for the state of the thread that contains the other app. and sleep again some time if thew other app has not finished yet. and so on...
Please excuse my english, It can seem a little rude, but it's all what I can do.
And thank you a lot for your answer... (could you give me another one?)
thank you in advance.
|
|
|
|
|
Check out WaitForInputIdle(). It just might do what you want.
|
|
|
|
|
I've created an mfc application and i'd like to skin it like winamp or neoplanet. Is there a code sample?
|
|
|
|
|
|
|
Skinning is something you should deign the app to do initially, rather than try to retrofit into it. But, as others point out, there are some examples. Don't be surprised if there is way more work involved with skinning it than you originally spent on the app.
|
|
|
|
|
I created a dialog based app that uses skins pretty easily. All I did was set a background bitmap for my dialog(Link 1) then I used a program to create a rgn file(Link 2) that my app loaded and then I set the region to the rgn in memory. You could then go on to use a bitmap buttom to create skinned buttons. This is very primative but does the jobs. The concept could be used to create fully skined apps. I created a BeOS clone app using this.
Bitmap Dialog: (http://codeguru.earthweb.com/dialog/BmpDlg.shtml)
RGN Creator: (http://www.codeproject.com/gdi/rgncreator.asp)
A Class: (http://www.codeproject.com/gdi/coolrgn.asp)
This code shows you how to make a dialog draggable by clicking anywhere on it, might be useful since you want have a title bar: (http://codeguru.earthweb.com/dialog/drag_dialog.shtml)
|
|
|
|
|
Well, if I understood right you want to put a bitmap over a button to get a custom designed button.
I tried a lot of things putting maps over a standard-button. The results were all very slow - especially after fast mouse-events.
And heres the way I finally made it and the result is of very high speed - even during fast mouse-events:
1) creating all the bitmaps you need for one button ( can be more then two )
2) put the maps as need to display and store x/y
3) check x/y after WM_LBUTTONDOWN / WM_LBUTTONUP (->wParam)
4) put a different map to display if button x/y matched
There is another important point :
you can use 4 different maps for one button if you also check out for MK_LBUTTON after WM_...
- on ( maybe with LED on )
- on/down ( maybe with LED on )
- off
- off/down
Greatings Mario///
--------------------
www.klangwerker.de
rocknix@lycos.de
--------------------
|
|
|
|
|
#include <iostream>
using namespace std;
class Rational
{
private:
int iNumerator;
int iDenominator;
public:
friend ostream &operator <<(ostream&, Rational&);
Rational(int num=1, int den=1)
{
iNumerator = num;
iDenominator = den;
}
};
ostream &operator <<(ostream &output, Rational &r)
{
output << r.iNumerator << "/" << r.iDenominator << endl;
return output;
}
int main()
{
Rational r1, r2(5,7);
cout<
|
|
|
|
|
I cut & pasted your code into VC and it compiled fine.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
Hi
I have a generic class (KodakCard) which has an ActiveX control in it. The ActiveX control can fire events, but i don't want to receive them in any of my view classes but instead within the KodakCard class. This would be good encapsulation. Yet because KodakCard is a non-MFC class it doesn't seem to be receiving events (nor any other of my view classes presumably because they're not hooked up to the control).
So how do i do it? I'd prefer to keep it all MFC, without any ATL stuff, but whatever is easiest.... ...I've tried creating a new class derived form CmdTarget (CKodakEventSink) and editing the *.odl file and adding the activex control's guid to it then creating an instance of CKodakEventSink in KodakCard but I can't get it to work because i don't understand *why* I'm doing it (even MSDN can't help sometimes ...
If someone could explain the logic involved or point me to a web page/book that explains this process that would be great...
Thanks
Brendan
|
|
|
|
|
Check my website www.braem17.yucom.be for an example on how you can receive events from an ATL control. You can find the page on http://www.braem17.yucom.be/FileMonitorSample.htm. It describes how can use the FileMonitor control in a MFC project.
hope this helps,
Franky.
|
|
|
|
|
Hi,
You need to write a sink in ur class which will hook up with the activex control. The events fired by activex control are just callback functions of a class, the activex control defines a class for the client to implement, once you link ur class to the activex control using the Advise method the events that are fired by the control actually executes the functions in your class that u have linked. For more information please refer Connection Points in MSDN COM Section. Or Just search for Connection Point.
Regards
Manjunath
|
|
|
|
|
Good evening,
Trying to develop a solution the right way. I'm trying to keep this whole thing as modular as possible, so that if one application(except for the manager) goes down, no other application, including the manager is affected.
I have one application(process) that manages many resources, it is important that these resources are available 24/7. Different applications( about 20 different ones, each of which at times are taken down for modification/upgrade ) will interface with the managing application for use of the resources. The manager will tell the application that is using the resource that a specific event occured and the application will respond with next action(state machine). The manager will take the action on the resource, and send the next event to the application using the resource... until the application is done with the resource... when done with resource the manager adds it to the pool for availability.
I am presently using MSMQ for the communication. I basically send a const recognized by all concerned in the subject line, and if any data is required, I put it in the body in comma delimited format.
It seems I'm working really hard to keep this thing together. Additionally, these events/responses must be quick... I can get up to 150 a second.
How would you do it?
Thanks!
Scott!
|
|
|
|
|
I wanted to delete several classes from my project. Following procedure given about 1000 posts ago I removed the .cpp and .h files for the undesired classes from my project folder. I then deleted the .clw file, reopened my workspace and hit Ctrl+w. The Class Wizard came-up and said I had no .clw and would I like one? I said yes and .clw was rebuilt. I examined the .clw and the unwanted classes are indeed gone.
Problem is this: the deleted classes still show-up in the Class View window, and the file names of the removed files persist in the File View window. How can I cause my workspace view windows to show the updated project configuration?
I am running VS5-SP1, in the process of d'loading SP3.
Alternatively, what I am trying to do is set-up a project workspace that is hooked-up to MFC and wizards, but I want to avoid (for the time being) some of the files that AppWiz generates for me so that I can build from scratch and learn the details. I want to keep only the app class and the mainframe class.
I am a beginner at MFC and VC++, but I have solid experience in C.
Tadzu
|
|
|
|
|
Why are you d/l SP3 instead of 4 ? Are there issues I haven't heard about ?
As to your files, if they've been deleted from the folder, and also removed from the project in file view, I'd be surprised to imagine where visual c is finding out about them. There are a number of other projectname.ext files, you *could* back them all up and try deleting other files as well as the .clw and figure out where it's being stored there.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
Problem is this: the deleted classes still show-up in the Class View window
Close the workspace, delete the project.ncb file, then reopen the workspace.
--Mike--
http://home.inreach.com/mdunn/
Is history an illusion caused by the passage of time, or is time an illusion caused by the passage of history?
|
|
|
|
|
Okay, the unwanted classes are gone, now.
Just a beginner's mistake. Turns-out that "Delete" does not show-up on the shortcut menu (right-mouse-click menu) when in File View, so I deceived myself into thinking that there was no delete option. The "Delete" option is in the edit menu of the mainframe, as Christan pointed-out.
Rereading the Environment User's Guide.
Tadzu
|
|
|
|
|
You can also just hit the delete key.
|
|
|
|
|
Hi, i am trying to do i game, and when a player wins, a message comes saying "player 1 won"
i want to reset the game, when the butten is pressed.. Is there a way i can return to the stat the game was when i first opened the program?? if so please tell me, so i dont need to close and reopen the game all the time
Thank you..
|
|
|
|