|
How to limit resizing of the window? (Minimal size should be 100x100).
|
|
|
|
|
|
Hi,
I'm very new to MFC and have a very basic question.
How do I fire an event/massage from my program?
For example,
In the Tree Control,
Right Click on the Tree Control doesn't change the selection, so by using
m_nTree.GetSelectedItem(), I get the item which was selected earlier (even if I right click on a different item). If there was any way to trigger TVN_SELCHANGED event from the handler of right click event, my task would have been easier.
Please help.
Thanks,
|
|
|
|
|
try PostMessage or SendMessage.
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
How can I add a custom menu to Internet Explorer(i.e an extra menu to Internet Explorer like utilities to do certain task)
|
|
|
|
|
Hi group,
I am using OLE to interact with MS acces ,to import a CSV file into a table in the database.I am using Access Application object and calling its TransferText function to do it.As it runs into a separate process,i am facing a problem.My program is using this table,so i must know ,when the transfering operation is completed,and ensure that all the database dependent operations are supende till than,is there any method to do it?
Could the experts give any idea?
|
|
|
|
|
I'm trying to learn how to generate a random number (for a jukebox to play MIDI songs). I bought the C++ standard library reference book and it explains what rand( ) does, but I've not been able to get it to work yet. I don't see any complete examples. I have several books, but they don't talk about rand( ). I also have discovered the random_shuffle function as well, but don't know how to make it work. The biggest problem I've had so far with programming is to implement the code for the various functions. Anyway, I was hoping someone(s) would give me a simple working example of both
1. rand( )
2. random_shuffle( )
I would appreciate it much,
Thanks...Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
// Seed the random number generator
srand( time(0) );
// This is the highest number we want
const int nMaxNum = 1234;
// Generate it
int nNum = rand() % nMaxNum + 1;
rand() gives us a number between 0 and RAND_MAX (which if i recall correctly is ~32768 on VC6), so to convert it to the range we want, we divide it by the max number and take the remainder.
random_shuffle() randomises the order of components in a random access container such as a vector - you should not be using this function to generate a random number, but instead you could insert the records for all the songs into a vector, and then call random_shuffle on the vector to randomise it.
e.g.
struct Record
{
string sName;
// Data for the song itself
};
vector<record> vSongs;
// Add some songs
vSongs.push_back( record1 );
vSongs.push_back( record2 ); // etc...
// Randomise them
random_shuffle( vSongs.begin(), vSongs.end() );
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks Dave,
I'll give it a try. I was trying to use the get_time( ) function, but didn't think of doing it the way you did. Is get_time something entirely different?
Thanks much, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
By the look of things, get_time() retrieves a time from an input stream - but i have never used it so i'm not sure. time() retrieves the time from the system clock instead.
Dave
http://www.cloudsofheaven.org
|
|
|
|
|
Thanks for the great example Dave, I'll spend some time with it. I did get the rand() working.
Thanks, Dave
"The man who reads nothing is better educated than the man who reads nothing but newspapers."- Thomas Jefferson
|
|
|
|
|
My application uses a single window, but I'd like it use real time video from a capture card as the background, and have text displaying over it.
I'd like input text displayed in one area of the window, output text in another area etc..
My concept is to have additional windows with transparent backgrounds for displaying the text.
I have to admit I'm a rookie programmer, so hope someone can help or point me in the right direction.
regards
ribbs
|
|
|
|
|
I have a tree view that has some drag and drop features however i would like to cuase the tree to scroll when the user drags item to the bottom of the tree does how do i cuase the tree view to scroll ?
on a side not i want to be able to handle multiple popup menu clicks in 1 function within the tree view how would i determine what menu item was clicked? and is there a function that already exists that i can use?
|
|
|
|
|
1- I think the way to do this is to add a timer and manually scroll the tree view.( I might be wrong) but I don't know how to do it right now.
2- you can use the ON_COMMAND_RANGE() message to send multiple commands to a single function, the handler receives the ID as a parameter; but you need to have the IDs consecutive, which can be dangerous in the long run; it is preferable to have one handler for each menu entry and from each function, call one other function.
If you are using popup menu with TrackPopupMenu, you can have tre function return which menu item you clicked.
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
i created the dialog class associated with my menu.
say, click on File, then , Move,, the dialog (COrigin) pops up
now,, in the dialog, when the user clicks on a button, IDC_BUTTON1
the function associated with this button is:
void COrigin::OnButton1()
{
//I have to get a pointer to change a variable in the View or Doc class
//which ever is easier.
}
Ehsan Behboudi
|
|
|
|
|
The easiest way to do it would be to put a function in your dialog class that takes a doc or view pointer, example:
void COrigin::SetDocument(CMyDocument *pDoc)
{
myDocPtr = pDoc;
}
And then wherever you need to use the document, you can use myDocPtr. Whoever creates and calls up the dialog would be responsible for setting the document pointer, it'd go something like this:
COrigin dlg;
dlg.StDocument(blah);
dlg.DoModal();
If you have an SDI doc, you could probably fidn a way of geting the document from the applicaiton class, but doing it tihs way makes it more flexible in case you ever go MDI.
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
I'm working on a project and i need some sort of list object in memory, it just has to exist in memory, i'm not talking about a gui list or anything. The list should be able to hold anything i want... like.. every entry should have its own unique ID (an integer value), a name (a string value) and possibly others. But each new entry will have the same types of values as the others, if u know what i mean. Then i should be able to add entries and remove them quite easily by calling a function on it or something sort of like this:
list.AddEntry(<unique id>,<name>, etc...);
list.RemoveEntry(<unique id>);
I hope u know what i mean. Now my question is, how is this commonly done? Do people build their own structure or something? and write all the add and remove code themselves? Or is there maybe an existing object i can use (and i'm not talking MFC, just basic c++ with stdlib etc.). I've seen someone use a vector or something before but i'm not sure what thats about, and they used a strange way to declare the variable like..
int<vector> bla;
or something like that..can't quite remember.
But anyways i'm just looking for the right way to do it
Thank you.
Kuniva
--------------------------------------------
|
|
|
|
|
If the IDs are not sequental use a map, otherwise a list or vector will do.
vector<int> intvec;
John
|
|
|
|
|
Thanks! But do you happen to know where i can find more information about a "map" since i have no clue what that is..
Kuniva
--------------------------------------------
|
|
|
|
|
|
hi
I have a single document , MFC project, with a few dialog classes.
In one of the dialog member functions, i have to get access to a member variable of my View class.
How can I do that..
its basically a pointer to the view class
what is the code
Ehsan Behboudi
|
|
|
|
|
Pass the dialog a pointer to the view class before you call DoModal().
John
|
|
|
|
|
how u write a sample code please?
Ehsan Behboudi
|
|
|
|
|
Where do you create the dialog? From your view??
John
|
|
|
|
|
i created the dialog class associated with my menu.
say, click on File, then , Move,, the dialog (COrigin) pops up
now,, in the dialog, when the user clicks on a button, IDC_BUTTON1
the function associated with this button is:
void COrigin::OnButton1()
{
//I have to get a pointer to change a variable in the View or Doc class
//which ever is easier.
}
Ehsan Behboudi
|
|
|
|