|
add following line b4 including "wincrypt.h"
#define _WIN32_WINNT 0x0400
greatest thing is to do wot others think you cant suhredayan@omniquad.com>
messenger :suhredayan@hotmail.com
|
|
|
|
|
yes, I have to define
#define _WIN32_WINNT 0x0400
before #include <wincrypt.h>
Thanks
|
|
|
|
|
In my edit control derived class I need to make it so that when the user hits the enter key that the control's focus is killed, how can I do that?
|
|
|
|
|
send the WM_KILLFOCUS message
|
|
|
|
|
In Windows, exactly one window must have the focus at all times. So, simply sending a WM_KILLFOCUS to the edit control won't do anything. You have to explicitly call SetFocus() on another control to give it the focus to remove the focus from your edit control.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am programming a word game with a 3d engine that has a scripting language, but next to no string support, so I am trying to write a little plugin in C++ to do most of the string functions for me. Basically,I have a HUGE word list in a text file that I already split up into 26 individual files of different letters. Even still, each text file has about 10,000 words in it!! I need a way to check for the existance of a word in one of the files (not in part of a word in the wordlist, but AN ACTUAL WORD IN THE WORDLIST). Unfortunately, I don't know too much about external file i/o in C++ so I am kind of confused as to where I should begin. I know that I can't just scan through each individual word in the text file, and compare it with the word that I am looking up. That would take forever. I thought that what I could do was try to limit the scope of the searching by indexing through the file and checking the second and third letters of the words, and narrow down the scan that way. My problem is that I don't know if its even possible to move through a text file as if it were an array (eg. by line number). If its not, than must I place each word into a huge string array? Once the array has been created, things should go fast, but I have a feeling it would create quite a loading time to fill such a humungus array 26 times! I also may be approaching this problem completely wrong, so feel free to give a completely different spin on the problem. If anybody has any answers for me, I would greatly appreciate it. Thanks again!
Andrew
|
|
|
|
|
You can read the data in, then create a small program to export the data to the
{"word1", "word2" ... } text file format, then turn this into an include file. With this this as an array, you can further optimize by putting it into a hash table, or a binary string array. (do a search in CP for more information)
My neighbours think I am crazy - but they don't know that I have a trampoline. All they see my head bobbing up and down over the fence every five seconds
|
|
|
|
|
I have a program that basically acts like a menu and all functionality is added using DLL's. I am wondering how to pass data to a DLL when initilizing it. For example I would like to pass:
1) Version number
2) Handle to calling window
3) Handle to misc helper DLL's
4) Pictures Directory
5) Music Directory
6) etc
How do you do this?
Thanks,
Steve
|
|
|
|
|
You can either call a Init method and pass all these parameters to the dll...
or passthem as the parameters to the corresponding api that needs it.
*Warning* If you pass handle of the calling window to the dll and you make it global in the dll.. You will have lot of problems. Avoid global variables except for constants.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
So, could I just pass a struct to the init method?
struct info
{
CString Version;
CString MusicDir;
CString PictureDir;
};
The reason I am wanting to pass in the handle of the calling window is that I want to be able to pass messages to it. Is there another way? I built in my plugin interface a way to pass messages to the plugins but I don't know how to send messages to the main application ( Dialog app in my case ).
What kind of problems are you refering to in your warning?
|
|
|
|
|
smesser wrote:
What kind of problems are you refering to in your warning
Its the problem related to multithreading... What if two applications load your dll and pass handle to window...
if you make it global then which window will it refer to.
Check Thread Local Storage for that matter.
You can use callback functions to notify back the messages.
MSN Messenger.
prakashnadar@msn.com
Tip of the day of visual C++ IDE.
"We use it before you do! Visual C++ was developed using Visual C++"
|
|
|
|
|
Mr.Prakash wrote:
What if two applications load your dll and pass handle to window...
if you make it global then which window will it refer to.
Each application will get a separate copy of the application data, unless the data section in the DLL is marked as "shared". I think what you mean is two threads from the same application call the Init function with different windows, then there will be a problem as you have indicated. But if the Init function is only called from one thread, then there is no problem using a global variable.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for the explanations all.
Mr.Prakash wrote:
You can use callback functions to notify back the messages.
Could you elaborate on this point? How would a callback function notify back to the calling application.
So that you understand my set up. My main application is a dialog based application and so are the plug-ins. So lets say a plug-in wants to tell the main application that a song has just ended (end of song event).
Thanks
|
|
|
|
|
Declare a pure virtual class that your dialog etc will inherit from. Then you pass a pointer to your dialog across to the dll and it calls the functions it required on this calss object:
class MyCallBacks
{
virtual void Callback1(parameters) = 0;
virtual bool Callback2(parameters) = 0;
}
CMyDialog : public CDialog, public MyCallbacks
{
void Callback1(parameters);
bool Callback2(parameters);
}
So when you init your DLL, pass a MyCallBacks* pointer in the structure across. Then in the DLL, if you need to do a certain actio, you would do:
if (m_pCallback != NULL)
{
m_pCallback->Callback1(parameters);
}
Hopefully this makes some sense!
Roger Allen - Sonork 100.10016
Strong Sad:
Clever I am? Next to no one.
Undiscovered and soggy.
Look up. Look down. They're around.
Probably laughing. Still, bright, watery.
Listed among the top. Ten.
Nine. Late night. Early morn.
Early mourn. Now I sleep.
|
|
|
|
|
Yes, that makes sense.
Thanks
|
|
|
|
|
Hi Gurus:
i m new to VC++. i want to make a make a button , a default button at run time , i know a button could me make a default button at design time be setting its property as default button , but how could this get at run time .......
thanks in advance.....
Touseef Afzal
"Winner's don't do different things , they do things differently "
|
|
|
|
|
btn->SetButtonStyle(btn->GetButtonStyle() | BS_DEFPUSHBUTTON)
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
Hi:
i have an SDI Application in which i have used CFormView as my view Class ,
i have tried this code
btn->SetButtonStyle(btn->GetButtonStyle() | BS_DEFPUSHBUTTON
but it just change the look of button from simple look to a dark black rectange showing that button has now default button property , but the button is not working as default button .....
help please..........
thanks.....
"Winner's don't do different things , they do things differently "
|
|
|
|
|
Check out DM_SETDEFID.
You post this to the dialog (in this case, the form view), and pass WPARAM which is the ID of the button you want to be default, leave LPARAM as NULL.
Steve S
|
|
|
|
|
Hi everyone,
I did not know which forum would get closest in relevance to my question, so I posted it here. I am really sorry if it is the wrong place.
I am trying to learn DirectX and was looking at DirectSound in particular. I was looking at the documentation for mixing various DirectSound buffers and playing them simultaneously. However, this concept of simultaneous playing bothers me. The documentation says that simultaneously played sounds are automatically mixed in the DirectSound primary buffer and played. I could not find an example of mixing multiple wave sources.
Now, here is my question:
Suppose I have 50 DirectSound secondary buffers. I want to ensure that they are mixed first and then played. What I could gather from the documentation is that I loop through the buffers and call Play() on them. However, that will certainly affect the synchronization of the buffers and they will not be played simultaneously. The documentation only states that you play the buffers simultaneously. I could not come across a way on how to do it.
I am pretty sure I am missing something here. So, if any DirectSound expert could shed some light on it, I would be grateful.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Looping through the buffers and calling Play() won't be a problem. AFAICR, The Play() method is asynchronous, so it flags the buffer to start playing and then returns. The actual delay involved in very minimal, so starting 50 buffers playing will only take a microsecond or so. Compare that with the time between two samples (20.8 microseconds at 48kHz), and the delay involved is much less than a single sample, so by the time the next sample comes along, all of the buffers will be ready. They may be out of sync by a single sample, but this will not be noticeable to us humans.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hey Ryan,
Thanks a lot for the explanation This really helps.
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hello.
Please, help me, how to set focus into EditControl when I run the application?
I know how to do it in Delphi, does anyone know how to make this in Visual Studio C++ ?
Thanks.
|
|
|
|
|
use SetFocus (a member of CWnd)
MyEdit->SetFocus();
|
|
|
|
|
Hello, everyone,
In my current project, I want to display xp style button(OK, Cancel and apply) in the properties sheet.
If I do it using MFC, it would be very easy. I just need to
m_btnXPButton.SubclassWindow(GetDlgItem(ID_APPLY_NOW)->m_hWand);
But when I tried to do the same thing in ATL, the returned handle for ID_APPLY_NOW (IDOK and IDCANCEL) is NULL.
How can I get the handle of a control in the properties sheet written in ATL.
Thanks a lot in advance.
bin
|
|
|
|