|
You can USe this Format
CString strToExecute;
strToExecute.Format("notepad.exe %s",<code>m_strFilename</code>);
WinExec(strToExecute, SW_SHOW);
or you can use ShellExecute
::ShellExecute(NULL,<code>"notepad.exe"</code>,<code>m_strFileName</code>,NULL,NULL,SW_SHOWNORMAL);
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
Maybe a stupid question but: I'm on Win2k with Visual C++ 6.0 and it seems nearly impossible to get any mousewheel code to work.....
I had to specifically #define WM_MOUSEWHEEL 0x020 to avoid "undeclared identifier" messages. Sadly my OnMouseWheel method is not recognized anyway.
I encountered several working MFC examples. Unfortunately I don't use MFC so my question is:
Is it possible to get this working without MFC? Do I need a special include for this?
thanx in advance
|
|
|
|
|
From WinUser.h
#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
#define WM_MOUSEWHEEL 0x020A
#endif Notice the #if ? Make sure _WIN32_WINNT or _WIN32_WINDOWS is defined properly.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
thanks for respons. I'm beginner to Winprog and VC++
I tried including <winuser.h> , but no improvement. Still the same undeclared WM_MOUSEWHEEL identifier.... My WM_LBUTTONDOWN is accepted though, both with and without <winuser.h>. WM_LBUTTONDOWN must be defined elsewhere also I concluded.
Next I outcommented WIN32_LEAN_AND_MEAN in Stdafx.h hoping this would make a difference. nope.
Other includes (a.o.): windows.h en windowsx.h
|
|
|
|
|
|
Joel Lucsy: I clicked on the link but the (forum) page states that
the page can't be found.....
|
|
|
|
|
|
Thanks. It seems I made a mistake
Moreover I assumed that VC++ would "know" what platform I'm working on: this seems to be not the case.
I #defined _WIN32_WINNT as 0x0500 abd now everything is working fine..
|
|
|
|
|
copy the file user.h who at the directory:
...VC98\include\
just under the VC++ install directory.
Try it, good luck !
|
|
|
|
|
Is there anyway to reverse find index?
POSITION pos=0;
int index=5;
pos = LinkList.FindIndex(index)
pClass = (CClass*) LinkList.GetNext(pos)
pClass = (CClass*) LinkList.GetNext(pos)
Is there a function to get the index value?
Basically a revsere of
pos = LinkList.FindIndex(index)
Give the pos value and find the index value
|
|
|
|
|
You can always write one like this:
int FindObjectIndex(CObList *pList, CObject *pItem)
{
CObject *pListItem;
int iIndex = 0;
POSITION pPos = pList->GetHeadPosition();
while (pPos)
{
pListItem = pList->GetNext(pPos);
if (pListItem == pItem)
return iIndex;
iIndex++;
}
return -1;
}
onwards and upwards...
|
|
|
|
|
Doh I was afraid of that, have to go through the whole link list just to find the index value. Guess I will cheat by setting the new index value myself.
|
|
|
|
|
The FindIndex function basically does the same thing, iterating through the list n times and returning the element.
onwards and upwards...
|
|
|
|
|
Hi, I was wondering if I am given a DLL with a set of header files to use (of which i don't have the source to). Is there a way to create a new DLL (with a new set of header files) that uses the functions of the old DLL without giving access to the old header files? Is this possible? In short, I want to create a new wrapper DLL with a new set of header files without sharing information of the old headers. I've been looking all over the web and couldn't find anything. Thanks!
RCJ
|
|
|
|
|
Hi There
I don't know if I have understand your question correct, but my answer is, to what I have undertand :
I would create a new header file, called DllInterface.h which will declare all the functions/methods that you want to export. Afterwards, create a new class called CreatorDll, which will implement all the original methods. In this class, in your cpp file, only include all the header files you want to hide. In the corresponding header file include the Interface file. If you have some classes which you want to offer users of the dll, make creator functions in your creator class, which returns with instances of the corresponding classes.
Then the places where you want to use the dll, only include the headerfile for the creator.
This is the way I do, when I want to export some methods of class, which perhaps uses a lot of classes.
I hope this gives you an idea, or maybe can help you in the wanted direction.
Best regards,
Søren Madsen
Denmark
|
|
|
|
|
I think it can been make:
1.We create a dll project whitch the new header file.
2.at our dll project,we relocate the function to the old function in the old dll,use Loadlibrary("old.dll"); and GetProcAddress(...) can do it.
3.builder our dll project,so we get a new dll.
|
|
|
|
|
Greetings,
I have a CFormView child with an embedded CDialog resource in it. When focus is anywhere outside of this embedded resource I can get input messages in the CFormView::PreTranslateMessage no problem but as soon as focus goes into the embedded dialog the only place I can get the messages is in the CEmbeddedDialog::PreTranslateMessage method.
I have even tried to locate the CFormView from within the CEmbeddedDialog::PreTranslateMessage method and call SendMessage on it from the data in pMsg but it still doesn't get into the CFormView.
Any ideas? Thanks!
|
|
|
|
|
Hi
I've written a DLL that uses Windows Sockets. The DLL gets inject into another process by calling WriteProcessMemory & CreateRemoteThread. The injecting and calling all works fine. The Target App loads the DLL and the Client even gets connected to the Server. But if i try to send something from the Server to the Client nothing happens. I don't know if the Client can send data to the Server. I'm using a multithreaded Server that can accept more than one connection by converting the CSocket Object to a DWORD. I don't know where the problem is.
MFG
RedDragon2kx
P.S. THE SOFTWARE IS NOT USED TO CAUSE DAMAGE TO SOFTWARE OR HARDWARE
Unix and C are the ultimate computer viruses.
|
|
|
|
|
Continuing on the Doc View architecture
Document Object = D
Server = S
View = A
from A I need to send user requests to S . These requests have to be processed via D as D houses and maintains the server object
Say within a routine in A
void A::ClickedServerUpdateButton()
{
CDocument *doc = GetDocument();
doc->????
}
Now Say D has a routine
void D:: SendRequest()
{
}
How do I invoke this from A .
If I need to call SendRequest
Is this a good practise to do the following within A.cpp
#include "NewDocument.cpp"
..
..
..
void A::ClickedServerUpdateButton()
{
// Is this
D *doc =(D*) GetDocument();
doc->SendRequest();
}
Engineering is the effort !
|
|
|
|
|
Hello my best friends,
I'm a beginner to Visual C++ programming, so I have some "stupid" questions for you and I hope you guys to help me.
I'm working on my own very simple chatapplication, but I encounterd some problems. I've made a client and a server part, I've tested it out but I had the problem that I couldn't send a text string. My serverside establishes a connection with the clientside ( I know it because I put some control messages to be sure there is a connection).
But when I try to send a peace of text, it does nothing except that it shows the sending text on my display and the receiver part shows nothing on the display. I used the following code to send a string:
void CSimComDlg::OnSend()
{
m_Message.GetWindowText(strMESSAGE);
m_pArOut->WriteString(strMESSAGE);
m_pArOut->Flush();
m_MsgDsp.SetWindowText(_T(Name+":"+strMESSAGE+"\r\n"));
strMESSAGE.Empty();
}
And to read a received string:
void CSimComDlg::ReadReceive()
{
m_pArIn->ReadString(strMESSAGE);
m_MsgDsp.SetWindowText(_T("Chatter:"+strMESSAGE+"\r\n"));
strMESSAGE.Empty();
}
m_pArOut and m_pArIn are CArchive pointers (I use this in combination with CSocketFile to send data over internet).
Is there something wrong with these codes?
I've seen some other example codes on the internet, they include also the length of the message to send and they check also the buffer if there's more data coming in. But are they neccesary to put them in my code?
I hope you can help me boyzz
If my application works, I forget all my problems.
If my application works, I forget all my problems.
|
|
|
|
|
|
Thnx for the reply on my message,
But actually I don't just want to copy some prepared codes where you just have to code for example: SendText("Hi how are you") and the rest goes by itself.
I want to know what I've done vrong with my code and what do I have to change in my code or what code do I have to add in my code.
I've seen some peaces of code using WriteString() and ReadString() with CArchive (wich needs also CSocketFile). I've seen also some codes using Send() and Receive of CSocket class.
When I know how to use these codes I can alway encapsulated them just like NDK application you reffered it to.
So I hope you can help me more about WriteString() and ReadString() and I hope other guys can help me too, you are all welcome.
If my application works, I forget all my problems.
|
|
|
|
|
I am trying to pass a pointer to an object to a function, and have this function to the work of creating the object. Although the object is assigned properly within the method, upon returning to the calling function, the object pointer that was passed has not changed. Could someone explain to me what is going on here?
I have an abstract class A and an inherited class B
<br />
Class A { doSomething(){} }<br />
<br />
Class B : A{<br />
int x;<br />
B(int x){<br />
this->x=x;<br />
}<br />
}<br />
Now, I want my class C to have a method that creates a pointer to A, passes this to a function, and that function changes the pointer so that it points to a new object of type B.
<br />
Class C {<br />
getB(){<br />
A* a;<br />
FindIt(a);
}<br />
<br />
FindIt(A* a){<br />
int x=1;
B* b = new b(x);
a = (A*)b;
}<br />
}<br />
So, when I debug...after the call to Find It, a is not pointing at the correct memory address. What is going on?
whitee
|
|
|
|
|
You were passing a copy of the "a" pointer to FindIt(). You need to pass it by address(or reference).
Class C {
getB(){
A* a;
FindIt(&a);
}
FindIt(A** a) {
int x=1;
B* b = new b(x);
*a = (A*)b;
}
}
|
|
|
|
|
I have initialized DX7, i have two buffers.
But I cannot figure out wich interface that have functions for rectangles, lines and so on.
the area I want to paint on is a LPDIRECTDRAWSURFACE7 interface. Can I through that get hold of an interface that has line/arc/rectangle functions?
|
|
|
|