|
can you change little architecture of your program, why can't non-modal dialog box notify parent dialog box.. when it closed!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/xml>
|
|
|
|
|
Hi,
Can someone point out an easy way to detect at a given moment if the current input language is Right to Left?
Thanks,
Moshe
|
|
|
|
|
|
How do I extract a part of my char*text
this is the function i would like to know if exists:
extract???(to char*,from char*,from int start,to int end)
if so, please whats its name and how do I use it?
char*text="hi how r u";
char*text2;
extract(text2,text,3,6);
Then text2 would be: "how"
Thanks.
|
|
|
|
|
Something like substr ?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
It's been a while since I've done a lot of C++, more C# these days
Isn't there something like strstr?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
yea, but i cant understand how it works, i mean they ask you for chars instead of ints I don't know how can i use it for doing this work.
|
|
|
|
|
I see what you are trying to do. Let me take a look here
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Have you looked at strncpy[^]?
That might be your ticket. Have the source string be the third character in your main string, and the length be the 5 - 3 + 1 = 3. Something along those lines.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Thanks it looks like the strncpy would work fine. but i have a problem
i have this:
char startup[MAX_PATH];
strcpy(startup, _pgmptr);
char startupnew[MAX_PATH];
strncpy(startupnew,startup,(int)(strstr(startup,"myapp.exe")-startup));
What i wanted to do was taking my app's startup path with the filename thing 'myapp.exe'. So i did this but the problem is that now startupnew, which is what i want is like: C://user/ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ until completing the MAX_PATH, but you know in a general case I wont know the actual length of the startup path. So what can i do in this case.
I want to delete this ÌÌÌÌÌÌÌÌÌÌÌ-thing.
|
|
|
|
|
letueros wrote: Thanks it looks like the strncpy would work fine.
Except it is not C++. If you are using a string object, it has the appropriate method(s).
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
What about std::string substr() function?
string substr( size_type index, size_type length = npos );
std::string i_am_a_string = "hi how r u";
std::string i_am_another_string = i_am_a_string.substr(3, 3);
Hope it helps!
|
|
|
|
|
oh, almost forgot:
char* i_am_a_char_pointer = i_am_another_string.c_str();
|
|
|
|
|
You could use CString::Mid()[^] also. See the code snippet.
CString csString = "hi how r u";
CString csExtracted = csString.Mid( 3,
3 );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hey everybody!
I wrote an application that performs global hooking on WH_GETMESSAGE to get clipboard hooking.
Now, I know that application doesn't have to use WM_PASTE while pasting, but I'm trying to get what I can with that.
The problem is that I'm getting WM_PASTE from Notepad, but not from anywhere else!
I read in a different forum that WordPad also uses WM_PASTE for pasting, but it doesn't seem to work in my case.
I also read that it is better hook WH_CALLWNDPROC than WH_GETMESSAGE to WM_PASTE, but when I'm hooking WH_CALLWNDPROC, I am not getting any WM_PASTE messages, not even from notepad.
Anyone have any ideas why I'm not getting WM_PASTE from WordPad (or any windows controls, like pasting to the "run" window) ???
Thanks a lot for your help!!!!!
|
|
|
|
|
Green Fuze wrote: I also read that it is better hook WH_CALLWNDPROC than WH_GETMESSAGE to WM_PASTE, but when I'm hooking WH_CALLWNDPROC, I am not getting any WM_PASTE messages, not even from notepad.
I just tried WH_CALLWNDPROC and it is working fine in the case of wordpad also. Can you paste the hook procedure you wrote...??
Why you want to hook paste operation??? Also in all case WM_PASTE need not to come such as a pate operation in a custom created window.
|
|
|
|
|
First of all thanks a lot for your help!!! (really!)
Here is the code I'm using in the DLL:
The code to register the hook:
<br />
void _declspec(dllexport) __stdcall registerHook(void)<br />
{<br />
hHook = SetWindowsHookEx(WH_CALLWNDPROC, MsgHookProc, hHookDLL, 0);<br />
}<br />
Here is the code of the MsgHookProc() callback function:
<br />
LRESULT CALLBACK MsgHookProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
if(nCode >= 0)<br />
{<br />
LPMSG m = (LPMSG)lParam;<br />
<br />
switch(m->message)<br />
{<br />
case WM_PASTE:<br />
case WM_RENDERFORMAT:<br />
case WM_RENDERALLFORMATS:<br />
MessageBox(NULL, L"Oh Yeah!", L"Paste", 0);<br />
break;<br />
<br />
case WM_COPY:<br />
OutputDebugString(L"Copy!");<br />
break;<br />
<br />
case WM_CUT:<br />
OutputDebugString(L"Cut!");<br />
break;<br />
}<br />
}<br />
<br />
return CallNextHookEx(hHook,nCode,wParam,lParam);<br />
}<br />
For your question of why I want to hook paste operation, well I'm a computer science student and I want to get a job in C++ development, I usually wrote .Net, so I was looking for a project to get my hands dirty and a bit of a challenge.
So I'm writing (well... trying to write ) a global copy/paste encrypter/decrypter.
Thanks again for your help!
|
|
|
|
|
Green Fuze wrote: LPMSG m = (LPMSG)lParam;
This the problem. If you are hooking the message using the WH_CALLWNDPROC , the LPARAM in the call back function is actually a pointer to CWPSTRUCT .
so change the code as follows..
PCWPSTRUCT pstInfo = (PCWPSTRUCT)lParam;<br />
switch(pstInfo->message)<br />
{<br />
.....<br />
}
Green Fuze wrote: a global copy/paste encrypter/decrypter.
Sorry I didnt understand the concept. If you dont mind can you explain( Just because am curious ).
Good Luck
|
|
|
|
|
Thanks a lot !!!
Using this method it works great in WordPad and windows controls, but using this method it doesn't work in notepad (pretty weird...).
WH_CALLWNDPROC should hook SendMessage(), so how come it misses the notepad which for sure gets WM_PASTE?
About the copy/paste encrypter/decrypter:
As we know it's really simple to create a clipboard viewer, meaning, every application can see what you're copying to the clipboard.
So every application can see what you're copying to the clipboard and theoretically can do malicious stuff with it.
So using the copy/paste encrypter/decrypter, you can encrypt anything you copy and decrypt anything you paste.
I know it might be a bit useless, but it's just for a bit of training....
Thanks again for your help!
|
|
|
|
|
Hi
I am writing this to help others who will also have the same problem
Creating worker thread :
CWinThread *pThread = AfxBeginThread(&MyThread,(LPVOID*)ptrParam);
MyThread is the member function of CWorker class,
and its prototype is UINT MyThread( LPVOID pParam ) ;
Now while compiling I am getting this error
Error 4 error C2665: ‘AfxBeginThread’ : none of the 2 overloads could convert all the argument types
We know the function prototype is correct.
MSDN ref :
UINT __cdecl MyControllingFunction( LPVOID pParam ); should be the function prototype.
We are also having the Exact prototype , so what could be the problem.
Solution :
All the Class member function will have one hidden parameter ( ie ) this pointer.
So Actucal function prototype of MyThread is UINT MyThread(CWorker pthis , LPVOID pParam ) ;
becoz of this, compiler gives this error.
To Solve the problem
1) Creating one global wrapper funciton around MyThread()
UINT wrapper(LPVOID pParam)
{
CWorker *p = new(std::nothrow) CWorker ;
if(!p)
return ;
p->MyThread(pParam);
return 0;
}
CWinThread *pThread = AfxBeginThread(&wrapper,(LPVOID*)ptrParam); wil work perfectly.
2) Declaring the member function as static
static UINT MyThread( LPVOID pParam ) ;
Note: static member funciton cant access non static member function and non static data member.
Regards,
WindowsPistha
|
|
|
|
|
There's nothing new about this. It's been discussed on this forum dozens of times, and there are even articles about it.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Yes you are right , I have red the below article before i posting.
It did not talk about , why compiler gives error.
so i thought of sharing here,I want to give something back to codeproject which gives lot of information to me.
http://www.codeproject.com/KB/threads/memberthread.aspx[^]
Regards,
WindowsPistha
|
|
|
|
|
|
Thank you Mr. David
here after i will double check before i posting.
Regards,
WindowsPistha
|
|
|
|