|
A program that I use detects I use detours on "DirectDrawCreate" They use "GetProcAdress" to detect it. detour make jumps 0xE9 or 0x90 thats wot they see.
IAT patching sounds like a solution for this problem can you show me a example maybe ?
|
|
|
|
|
IAT patching will only work if the DLL is not dynamically loaded. Is this the case? To check you the export table of the .EXE and see if it contains the API using "Depends.exe" or some such tool.
Steve
|
|
|
|
|
Well its an api function that is used in a game....
pbcl.dll which is dynamically loaded calls "DirectDrawCreate" in ddraw.dll
Is there a solution for my problem ?
|
|
|
|
|
I'm trying to pass an array of char* to a dialog box through the Sendmessage function. I seem to have no problem sending the message, but I'm not quite sure how to get access to the data from the dialog box. I'm not using MFC btw.
From my winmain I have
HWND hdlg;
char *items[4];
hdlg = CreateDialog(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_MERGE),hwnd,MergeProc);
data->get_dialog_items(items);
SendMessage(hdlg,WM_NOTIFY,MAKEWPARAM(SD_IMPORT_MERGE,items),0);
I think I have to use a typecast of some sort but everything I have tried so far is giving mw compilation errors. Any help would be greatly apprecitaed.
|
|
|
|
|
I don't know the code SD_IMPORT_MERGE that you are using, but it probably doesn't matter.
The other part of MAKEWPARAM would normally be a control ID rather than an abritrary variable, and you'd have a structure pointed to by LPARAM. I can't remember its off the top of my head though.
If all you are doing is sending a custom message to the dialog saying "here's a lump of text", why not use
UINT g_myTextMessage = RegisterWindowMessage ("Some unique string here");
.....
char *items [4];
...
SendMessage (hDlg, g_myTextMessage, 0, (LPARAM)items);
...
and in your dialog class:
...
ON_REGISTERED_MESSAGE (g_myTextMessage, OnSendATextMessage)
...
LRESULT CMyDialog::OnSendATextMessage (WPARAM wParam, LPARAM lParam)
{
char **items = (char **)lParam;
ASSERT(items);
if (!items) return 1;
lstrcpy (items [0], "Some Text");
lstrcpy (m_myBuffer, items [1]);
etc
return 0;
}
This is without reference, so please make sure of the names!
Good luck,
Iain.
|
|
|
|
|
Iain Clarke wrote: I don't know the code SD_IMPORT_MERGE that you are using, but it probably doesn't matter.
SD_IMPORT_MERGE is an identifier I am can trap within WM_NOTIFY. Not thats its very important it's just the way I was trying to get this to work.
Normaly when passing an of chars to a function I would define the function as MyFunction(char *foo[]), I was trying to derefrence using the same form. I noticed you used a double pointer which makes a little more sense.
Thankyou, I have got it working now.
|
|
|
|
|
I have a CString object which contains a string in the format: 00:11.2 (for example).
I have to isolate each of the parts of the string.
For example i need to get:
str1 = 00
str2 = 11
str3 = 2
how can I do this?
|
|
|
|
|
|
Yep, combined with CString::FindOneOf() where you provide the chars that separate different "parts" of the string.
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
Is there a way to trim part of the string?
(I want to read part of the string and then trim that part..)
For instance,after I find where the ":" is located, I want to trim the right most part of the string, and so forth for the other parts of the string...
|
|
|
|
|
SWDevil wrote: For instance,after I find where the ":" is located, I want to trim the right most part of the string...
CString str = "00:11.2";
int nIndex = str.Find(':');
str = str.Left(nIndex);
or
str = str.Mid(0, nIndex + 1);
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
sscanf(...) and its variants were designed for that kind of thing...
Read up on them to see how easy it would be to extract the components of the string.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
Hi All,
The problem I seem to be having is that events seem to be disappearing (i.e. no-one gets them). I have essentially 3 threads in a console application. The "control" class creates a number of events like:
m_stSyncEvents.m_hSyncRxStart = ::CreateEvent (NULL, FALSE, FALSE, NULL);
Later on, the code creates two threads. These threads then do a ::SetEvent (m_stSyncEvents.m_hSyncRxStart) when they finished their initialisation. The threads themselves have a common thead function and use the fastdelegate code to call back into the class. After the threads are created I do a:
::WaitForMultipleObjects (2, ahThreadSync, TRUE, INFINITE);
with ahThreadSync being handles to the event handles per thread.
The problem now comes that the second task that is created is not sending events or receiving them 100%. 2 /10 times it works perfectly. However the other times, the second thread does not send the event (but SetEvent is not failing) or it does not receive the abort event from the control class, which is created in a similar way except it is in manual reset mode. In each case the thread is running.
Any Ideas??
regards,
Rich
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
Are you suggesting BOTH of the 'alternate' threads are each setting m_stSyncEvents.m_hSyncRxStart? If so, you need two separate events. Each of those worker threads should set its own private event, and the waiting thread needs to wait on both of those separate events.
I would also have each thread own it own abort event.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Blake Miller wrote: Are you suggesting BOTH of the 'alternate' threads are each setting m_stSyncEvents.m_hSyncRxStart?
No. Each thread has its own event. There is a separate event created per thread object.
Blake Miller wrote: I would also have each thread own it own abort event.
The design was for a simplified exit mechanism. The threads wait on multiple events depending on what it is currently upto. Having a single 'abort' event that could trigger all threads to exit, was the reason for this.
"Programming today is a race between software engineers striving to build bigger and
better idiot-proof programs, and the Universe trying to produce bigger and better idiots.
So far the Universe is winning." -- Rich Cook
|
|
|
|
|
if a error occur in a function ,return false or handle it inside of function.
for example:
void fun()
{
bool isFail = openfile(...);
if(isFail)
{
::MessageBox(0,"open file fail",0,0);
exit(0);
}
}
bool fun()
{
bool isFail = openfile(...);
if(isFail)
{
return false;
}
........
return true;
}
|
|
|
|
|
|
sorry ,the question :
which error handle is right and commmon?
|
|
|
|
|
I wrappered a class to play video using DirectShow, almost following the sample "playwnd", but i found it cannot destroy the media window by the destructor, unless I destroy the parent window. I checked the state of the player window, it was stopped, but I could still saw it was running after the destructor invoked... Following list the destructor, what is the problem?
<br />
CMediaPlay::~CMediaPlay(void) {<br />
HRESULT hr;<br />
<br />
if (m_pMediaControl)<br />
{<br />
LIF( m_pMediaControl->Stop());<br />
OAFilterState fs;<br />
LIF( m_pMediaControl->GetState(200L, &fs));<br />
if (fs == State_Stopped)<br />
Msg(_T("Successfully stopped the filter run"));<br />
}<br />
<br />
if(m_pVideoWindow)<br />
{<br />
LIF(m_pVideoWindow->put_Visible(OAFALSE));<br />
LIF(m_pVideoWindow->put_Owner(NULL));<br />
}<br />
<br />
if (m_pMediaEventEx)<br />
LIF(m_pMediaEventEx->SetNotifyWindow((OAHWND)NULL, 0, 0));<br />
<br />
#ifdef REGISTER_FILTERGRAPH<br />
if (g_dwGraphRegister)<br />
{<br />
RemoveGraphFromRot(g_dwGraphRegister);<br />
g_dwGraphRegister = 0;<br />
}<br />
#endif<br />
<br />
SAFE_RELEASE(m_pFileSource );<br />
SAFE_RELEASE(m_pVideoDecoder );<br />
SAFE_RELEASE(m_pAVISplitter );<br />
SAFE_RELEASE(m_pSourceReader );<br />
<br />
SAFE_RELEASE(m_pMediaEventEx );<br />
SAFE_RELEASE(m_pMediaSeeking );<br />
SAFE_RELEASE(m_pVideoFrameStep );<br />
SAFE_RELEASE(m_pMediaControl );<br />
SAFE_RELEASE(m_pBasicAudio );<br />
SAFE_RELEASE(m_pBasicVideo );<br />
SAFE_RELEASE(m_pVideoWindow );<br />
SAFE_RELEASE(m_pGraphBuilder );<br />
}<br />
<font=sans-serif>|-|3llo Wo|2ld
|
|
|
|
|
My application was developed under Visual C++ 6.0, ATL, MFC & PlatformSDK Feb2003 (the last VC6 compatible version).
I am wondering if PlatformSDK Feb2003 is compatible with Visual Studio.NET 2003? I am having major problems trying to port/build my application under Visual Studio.NET 2003 using the unmanaged/native C++ compiler.
I was told that Visual Studio.NET 2003 had native C++ compiler support. I am aware about the new C++ 1999 changes (eg. #include <iostream>, using namespace std; etc). However my errors seem to be related to the PlatformSDK Feb2003. eg:
<br />
<br />
<br />
error C2039: 'Delete' : is not a member of 'CCommandEx<TAccessor>' with [TAccessor=ATL::CManualAccessor]<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
error C2065: 'AFX_OLE_DATETIME_ERROR' : undeclared identifier<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
error C2143: syntax error : missing ',' before '<'<br />
<br />
NOTE: what is this issue about templates??? my templates are like:<br />
<br />
(code snip)<br />
template <class TAccessor = CNoAccessor, template <typename T> class TRowset = CRowset><br />
class CAccessorRowset :<br />
public TAccessor,<br />
public TRowset<TAccessor>
{<br />
(code snip>)<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
error C2440: 'type cast' : cannot convert from 'CFile' to 'HFILE'<br />
<br />
(code snip)<br />
if ((HFILE)File==CFile::hFileNull)<br />
(code snip)<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
error C2475: 'CDouble::GetDoubleValue' : forming a pointer-to-member requires explicit use of the address-of operator ('&') and a qualified name<br />
<br />
(code snip)<br />
if(Value.GetDoubleValue != 0)<br />
(code snip)<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
error C2516: 'TRowset' : is not a legal base class<br />
<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and there's more. What was wrong with Visual C++ 6.0? and why is there so many errors when trying to compile under Visual Studio.NET 2003? Does anyone know a quick conversion script?
-- modified at 9:07 Monday 6th March, 2006
|
|
|
|
|
Hmm, now that you asked am not sure myself.
I just installed Visual Studio.NET 2003 on another PC and copied my Visual C++ 6.0 entire project over. Then I double-clicked on the .dsw (Visual C++ 6.0 Workspace... solution/collection of projects).
It loaded saying it has to convert the projects into VS.NET 2003 projects. I said yes to all.
Question: But where do I find out whether my solution is building on unmanaged or managed C++?
|
|
|
|
|
Thanks. I manage to fix some of these errors. There's still some errors that
buffle me.
1. DLL creation:
HGBaseu.def(76): fatal error LNK1118: syntax error in '70' statement
(points to)
?CreateThreadProcessor@CGeneralTimerThreadQueue@@MAEPAVCGeneralTimerThread@@V<br />
<br />
CHGVoidCall@@J@Z 70 NONAME
2. Originally it said ostream cannot be inline so I commented that out.
However I don't understand the errors:
GUID.h(54): error C2143: syntax error : missing ';' before '&'<br />
GUID.h(54): error C2501: 'ostream' : missing storage-class or type specifiers<br />
GUID.h(54): error C2065: 'strm' : undeclared identifier<br />
GUID.h(54): error C2065: 'ID' : undeclared identifier<br />
GUID.h(54): error C2275: 'CGUID' : illegal use of this type as an expression<br />
GUID.h(54): error C2501: 'operator`<<'' : missing storage-class or type <br />
<br />
specifiers<br />
GUID.h(54): error C2365: 'operator`<<'' : redefinition; previous definition <br />
<br />
was a 'member function'<br />
GUID.h(54): error C2078: too many initializers<br />
GUID.h(55): error C2143: syntax error : missing ';' before '{'<br />
GUID.h(55): error C2447: '{' : missing function header (old-style formal <br />
<br />
list?)
(all points to)
ostream& operator<<(ostream& strm,CGUID& ID)<br />
{<br />
return strm<< (CString)ID;<br />
}
3. Some problems with namespaces:
SortedArray2.h(75): error C2039: '[]' : is not a member of 'operator``global <br />
<br />
namespace'''
(points to)
inline TYPE& CSortedArray2<TYPE>::operator[](int nIndex)<br />
{<br />
return m_InternalArray[nIndex];<br />
}
I get a lot of repeated errors of the above 3 plus lots of template errors. I
believe Visual C++ 6.0 didn't comply with the C++ standards on how to define
templates right?
-- modified at 11:56 Monday 6th March, 2006
|
|
|
|
|
Often when programs start (i.e. MS Word), there is a small window that shows the program icon, program info, registration info, etc... This window then disappears when the application loads in full. How do I programatically create the small start-up window that lasts until the full program loads?
Thanks,
Blitz
|
|
|
|
|
It's called a "splash screen" or "splash window."
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks, I appreciate the info.
|
|
|
|