|
You can download the Direct X SDK from Microsoft, as well as a lot of useful information about it from here.
It's fairly easy to use, and comes with plenty of sample code to get you started.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
|
If you want to do this programmatically, it's fairly straightforward as well.
The actual method will depend on which audio API you're using. e.g. in DirectSound there's a "SetPan" method which can pan a buffer between left and right. So just load and play the two sounds, and set one to fully left pan, and the other to fully right.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hi,
I'm using a Rich Text Edit control that reads in from a file at run time.
I would like to include the file as a resource of the project without having to install the file to a location where the user can tamper with it.
Is it possible, and if so, how can I achieve this?
I must add that I am using Visual C++ .Net (version 2003)
TIA
Tony
|
|
|
|
|
Yes, it is possible, just add this to your .rc file:
IDR_MYOWNRESOURCE_ID MYOWNRESOURCE_TYPE DISCARDABLE "res\\MyFile.rtf"
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
It is possible, yes, but you have to code it, afaik by defaults there's no pre-maid way to do it.
You have to use FindResource, LoadResource, LockResource, CRichEditCtrl::StreamIn in to read the file up from memory.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
As a follow up to this I have successfully managed to load the file as a resource, which is brilliant so thanks for the help.
One problem I am experiencing though is that I want to extract different sections of the file dependant on conditions, and I'm finding that if the document is saved from Micorsoft Word 2003 the string doesnt seem to be able search the file content, but using Wordpad all is OK.
I have just typecast the LPVOID I receive from LockResource to a CString
<pre>
CString csMess = (LPCTSTR)lpResLock;
</pre>
As I say this is OK if the file is saved from WordPad.
Any Suggestions?
Tony
|
|
|
|
|
i create a edit control whose parent window is in another process, i hook the parent window callback functin, just like this:
SetWindowsHookEx(WM_CALLWNDPROC, MyCallbackFunc, hDllMOdule, idProcss)
but i can't receive WM_CTLCOLOREDIT in my callback function, why?
i'll cry, who can help me? thank you very much
|
|
|
|
|
Is your edit control read-only or disabled?
From MSDN:
Read-only or disabled edit controls do not send the WM_CTLCOLOREDIT message; instead, they send the WM_CTLCOLORSTATIC message.
Greetings
Covean
|
|
|
|
|
no, it can gain input
My code like this:
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
PCWPSTRUCT pWps = (PCWPSTRUCT)lParam;
if (pWps->hWnd == hookWnd)
{
switch (pWps->message)
{
case WM_CTLCOLOREDIT:
{
some operation! // never receive this message
}
break;
}
}
}
|
|
|
|
|
Do I understand you right? Somehow you got the hWnd of an external app, after that you created an
edit control from your app and attached it to the parent hWnd from the external app?
If so, then this might be the problem (from MSDN):
The WM_CTLCOLOREDIT message is never sent between threads, it is only sent within the same thread.
This is just an assumption and maybe someone else could approve or disprove this.
Greetings
Covean
|
|
|
|
|
yes, you are correct! i'll cry, how can i do, it can't communicate between process, but i need this character
|
|
|
|
|
Here is some code I used with a low-level key hook to attach my thread input to the ones of the other
process. I used it in combination with ToUnicodeEx to get the displayed char. But I don't think this will solve your problem but I would give it a try.
Attach:
DWORD dwThreadWindow = GetWindowThreadProcessId(pVirtualLLKeyBoard->GetMessageWnd(), NULL);
DWORD dwThreadForeWin = GetWindowThreadProcessId(GetForegroundWindow(), NULL);
BOOL bAttach = FALSE;
BOOL bAttached = FALSE;
if(dwThreadWindow != dwThreadForeWin)
{
if(dwThreadForeWin != 0)
bAttach = TRUE;
}
if(bAttach)
bAttached = AttachThreadInput(dwThreadForeWin, dwThreadWindow, TRUE);
"pVirtualLLKeyBoard->GetMessageWnd()" is the window of my app.
Detach:
if((bAttach)&&(bAttached))
AttachThreadInput(dwThreadForeWin, dwThreadWindow, FALSE);
After you got the hWnd from the other process, I would try to attach your thread to the window owning thread of the external application. On exit just detach it.
Greetings
Covean
|
|
|
|
|
|
Does it really work?
Greetings
Covean
|
|
|
|
|
i didn't try, but i create a parent window in the same process, it works!
|
|
|
|
|
Thanks for your reply this is nice to know!
Greetings
Covean
|
|
|
|
|
Hi,
MFC CListctrl flickers when i delete all the items and reload the list control at a frequency of 1 second. I am using .DeleteAllItems() method to delete all the items and .InsertItem() method to insert the items one by one. I am using a timer at a frequency of 1 second to delete and reload my CListCtrl.
So everytime it come across the DeleteAllItems() method, it shows a large flickering on the dialog window contains the CListCtrl.
Please suggest me any method to reload all the items without any flickering.
|
|
|
|
|
m_List.SetRedraw(FALSE);
m_List.SetRedraw(TRUE);
m_List.Invalidate();
m_List.UpdateWindow();
|
|
|
|
|
Thank you very much LunaticFringe for the above method. That worked for me.
Regards and Thanks
|
|
|
|
|
Hi All,
While building the COM DLL i am getting these three linking errors:-
1. error LNK2001: unresolved external symbol "public: virtual long __stdcall CScriptObject::QueryInterface(struct _GUID const &,void * *)" (?QueryInterface@CScriptObject@@UAGJABU_GUID@@PAPAX@Z) ScriptObject.obj
2. error LNK2001: unresolved external symbol "public: virtual unsigned long __stdcall CScriptObject::AddRef(void)" (?AddRef@CScriptObject@@UAGKXZ)ScriptObject.obj
3.error LNK2001: unresolved external symbol "public: virtual unsigned long __stdcall CScriptObject::Release(void)" (?Release@CScriptObject@@UAGKXZ)ScriptObject.obj
Please provide me some suggestions.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
|
Hi Rajesh,
Yes is an ATL COM DLL.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Are you overriding default AddRef, Release and QueryInterface implementations?
|
|
|
|