|
Thanks for the help. But The problem is not solved using GlobalAlloc , GlobalLock & GlobalFree. It invites the same access violation "Memory could not be Read". Still I can't find any way to assign an integer or HMODULE from within the NewProc. What should I do? Please show me a way. I have to solve this problem as soon as possible.Thanks.
|
|
|
|
|
The problem is solved finally using GlobalAlloc. Now I
have another problem. I have created an anonymous pipe
in the process from which I want to inject code to the remote process & passed the write end handle of pipe
to the remote thread as a member of its data. Now
from within the remote thread I want to write to the pipe using writefile & from within the other side I want to read the pipe. But the writefile is returning null. Please help me to solve the problem.
|
|
|
|
|
How can I open a new window with for e.g. www.ceco.se as a url.
Following code:
ShellExecute(NULL, "open", “ValidUrl/abc.html”, NULL, NULL, SW_SHOWNORMAL);
Opens a new explorer window if none already is open. Otherwise it uses an already open one, which I want to prevent.
...and justice for all
APe
|
|
|
|
|
Internet Explorer supports the -new command-line switch. Try that.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
This depends on the user's setting, which you should probably follow.
If you want to turn it off yourself, look in IE's Internet Options, Advanced tab, and uncheck Reuse Browser Windows For Launching Shortcuts.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Is there any way for a program to be notified when other processes are created and destroyed?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
if they are parent, yes, the child notify its parent when it is created and destryed
TOXCCT >>> GEII power
|
|
|
|
|
|
Hello CodeProjecters,
I am working on a multi-protocol chat client, and very stuck on what to use for HTML rendering. AIM uses HTML in its profiles, but it doesn't support very much of it: text foreground/background colors, font size and face changes, bold, italics, etc. Everything that a RichEdit supports -- except for a horizontal rule! I would like to avoid additional DLLs -- so QHTM/HTMLayout is out of the question. It is ridiculous how heavyweight the WebBrowser control is, too. Does MSHTML load in like 10 DLLs when you use it?
Now, I can write a HTML parser using Boost's Spirit parser framework library, and then apply those styles to the RichEdit control. I have already done this. However, I do not know what to do for the horizontal rule. I tried using a bunch of _'s, but it looked really ugly -- is there something else I could do? Perhaps owner-draw the control? I know demand for something like this control is very high, so I'd be willing to write an article about it. I just need to support HR's somehow.
Thanks.
|
|
|
|
|
I saw a lightweight HTML renderer in Windows Developers Journal, a long way back - maybe you could rummage through their archives or find someone who subscribes to the CD-Rom
This might also be of interest :-
http://www.codeproject.com/cpp/utf8ostream.asp[^]
Else, and I know you are going to hate me, go the the website for the author of the previous article (Andrew Fedoniouk, http://terrainformatica.com) and check out his offering - but its not source, it might only serve as 'inspiration')
sorry I cant help more .. ps.. just modified this - seems I should have re-read that link, he's just generating html not rendering it - sorry... follow the link to his homepage and look at his tools, anyway ..
'G'
|
|
|
|
|
Thank a lot
but it's wrong
I have a Class: CPolyBtn
I have a control: Button : IDC_BUTTON1
in MFC ClassWinzard I need :
ControlIDs Type Member
IDC_BUTTON1 CPolyBtn m_polybtn
In Dialog : Add Member Variable. I need:
Variable Type:
Cpolybtn
Help me. Thank alot
Hello
|
|
|
|
|
CTRL + W
Add member variable
Find and replace
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hello, this is probably my first post ever in this forum.
I need your help with writting two simple and small programs that simulate a server and a client running on the same computer(same host). In addition, one pair of client/server would concern TCP(stream sockets) and another that works with UDP(datagram sockets).
The two main classes that would interest me are CAsyncSocket and CSocket. If there is anyone who could show me a very simple code (like an echo application) or provide me a tutorial/link with such programs ,I would be most happy.
Note that if you're too bored or unwilling to provide code ,I wouldn't mind if you provided me a tutorial on how to build such a program.
Thank you in advance.
|
|
|
|
|
|
Here is some server code that listens on port 13:
void main( void )
{
WSADATA wsaData;
int rVal;
SOCKET client;
WSAStartup(MAKEWORD(1, 1), &wsaData);
SOCKET s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == INVALID_SOCKET)
{
fprintf(stderr, "Failed socket()\n");
WSACleanup();
return;
}
SOCKADDR_IN sin, clientaddr;
sin.sin_family = PF_INET;
sin.sin_port = htons(13);
sin.sin_addr.s_addr = INADDR_ANY;
rVal = bind(s, (LPSOCKADDR) &sin, sizeof(sin));
if (rVal == SOCKET_ERROR)
{
fprintf(stderr, "Failed bind()\n");
WSACleanup();
return;
}
rVal = listen(s, 2);
if (rVal == SOCKET_ERROR)
{
fprintf(stderr, "Failed listen()\n");
WSACleanup();
return;
}
for (;; )
{
int addrlen = sizeof(clientaddr);
client = accept(s, (struct sockaddr *) &clientaddr, &addrlen);
if (client < 0)
continue;
char *clienthost = inet_ntoa(clientaddr.sin_addr);
int port = ntohs(clientaddr.sin_port);
fprintf(stderr, "Received request from [%s] on port [%d]\n", clienthost, port);
rVal = send(client, "Have a nice day!", 16, 0);
closesocket(client);
}
closesocket(s);
} Here is some client code that requests data from port 13:
void main( void )
{
WSADATA rWSAData;
int nIndex = 0,
nResult,
nBytes;
SOCKET rSocket;
SOCKADDR_IN rSocketAddr;
char sBuffer[128];
if (WSAStartup(MAKEWORD(1, 1), &rWSAData) == 0)
{
rSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (INVALID_SOCKET != rSocket)
{
unsigned long ul = 1;
nResult = ioctlsocket(rSocket, FIONBIO, (unsigned long *) &ul);
rSocketAddr.sin_family = AF_INET;
rSocketAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
rSocketAddr.sin_port = htons(13);
nResult = connect(rSocket, (LPSOCKADDR) &rSocketAddr, sizeof(rSocketAddr));
if (SOCKET_ERROR == nResult && WSAGetLastError() == WSAEWOULDBLOCK)
{
timeval tv = {0};
tv.tv_sec = 5;
fd_set fdread;
FD_ZERO(&fdread);
FD_SET(rSocket, &fdread);
nResult = select(0, &fdread, NULL, NULL, &tv);
if (nResult > 0)
{
if (FD_ISSET(rSocket, &fdread) != 0)
{
nBytes = recv(rSocket, sBuffer, sizeof(sBuffer), 0);
if (nBytes > 0)
{
sBuffer[nBytes] = '\0';
fprintf(stderr, "Data from %s is ]%s[", inet_ntoa(rSocketAddr.sin_addr), sBuffer);
}
else
fprintf(stderr, "recv() failed. Error = %lu\n", WSAGetLastError());
}
else
fprintf(stderr, "FD_ISSET() failed.\n");
}
else
{
if (0 == nResult)
fprintf(stderr, "select() failed. Timeout\n");
else
fprintf(stderr, "select() failed. Error = %lu\n", WSAGetLastError());
}
}
else
fprintf(stderr, "connect() failed. Error = %lu\n", WSAGetLastError());
if (closesocket(rSocket) == SOCKET_ERROR)
fprintf(stderr, "closesocket() failed. Error = %lu\n", WSAGetLastError());
}
else
fprintf(stderr, "socket() failed. Error = %lu\n", WSAGetLastError());
nIndex++;
if (WSACleanup() == SOCKET_ERROR)
fprintf(stderr, "WSACleanup() failed. Error = %lu\n", WSAGetLastError());
}
else
fprintf(stderr, "WSAStartup() failed. Error = %lu\n", WSAGetLastError());
}
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
The MFC classes are generally considered to be a bit useless. They're based around the essentially obsolete window-based model. New applications should probably do their communications on a separate thread.
The Winsock Programmer's FAQ[^] is a useful resource.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Is there another way to detect when a user presses control plus "C" other than the signal command? Thanks.
|
|
|
|
|
In a console application, see SetConsoleCtrlHandler. For a Windows application, Ctrl+C doesn't get any special handling - you simply get WM_KEYDOWN , WM_CHAR , WM_KEYUP messages.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Sorry My English is very bad.
I start to learn VC++. you help me.
I want to see to create a member variable of type a class ( exam: CPolyBtn)
Thank a lot
Hello
|
|
|
|
|
if i understand you correctly
//don't forget to include the header file
#include "PolyBtn.h"
class CMySnazzyClass {
public:
CPolyBtn m_polybtn;
};
hope this is what you were asking otherwise i'll be embarrassed
i can't even remember what my point is now, but anyway, i'm correct
Barring unforeseen acts of God and Adminstrators, my server will be up tomorrow. I'm more worried about the Adminstrators.
|
|
|
|
|
as you said, it's not very easy to understand you, but anyway, i've got a little idea of what you want.
that is very simple. When you've designed a class, then you can use it as a nem type (user-defined type). You can so create variables of that types of any kind... globals, variables, members... check this :
<font style="color:blue;">class</font> A {
<font style="color:green;">
<font style="color:blue;">public</font>:
<font style="color:green;">
};
<font style="color:blue;">class</font> B {
A m_myAMember; <font style="color:green;">
<font style="color:blue;">public</font>:
<font style="color:green;">
};
hope that was helpful
TOXCCT >>> GEII power
|
|
|
|
|
Thank a lot
but it's wrong
I have a Class: CPolyBtn
I have a control: Button : IDC_BUTTON1
in MFC ClassWinzard I need :
ControlIDs Type Member
IDC_BUTTON1 CPolyBtn m_polybtn
In Dialog : Add Member Variable. I need:
Variable Type:
Cpolybtn
Help me. Thank alot
Hello
|
|
|
|
|
i'm not sure to understand this time. you want to add a CPolyBtn into a Button control ?
is that is right, you have to override the CButton class, an the add the member :
<font style="color:blue;">class</font> CMyButton : <font style="color:blue;">public</font> CButton {
CPolyBtn m_polybtn;
<font style="color:blue;">public</font>:
<font style="color:green;">
};
is that correct ?
TOXCCT >>> GEII power
|
|
|
|
|
oh sorry, i start to understand...
<font style="color:blue;">class</font> CPolyBtn: <font style="color:blue;">public</font> CButton {
<font style="color:green;"></font> m_polybtn;
<font style="color:blue;">public</font>:
<font style="color:green;">
};
but, what type will be your variable member ?
TOXCCT >>> GEII power
|
|
|
|
|