|
Well, looking at it fast I would use subnet mask (255,255,255,0)
on both computers, with allows them to be peers.
jhaga
|
|
|
|
|
Hello,
I have a ListBox control wich displays several strings. I want now to make some string more "visible" than other. For example, make a string bold, or color the text or color the background of the specified string.
How can I do this in a simple way ? Any idea?
Thanks
|
|
|
|
|
You'll need to make the control Owner Draw, then provide the code to draw your list items appropriately.
There are quite a few examples of owner draw list boxes here http://www.codeproject.com/combobox/[^]
|
|
|
|
|
Hi,
Is there any (legal) method to tell Windows where the .inf and other driver files for a certain device are?
I have to include driver (.inf and .sys) in an installation, and currently, the user has to browse for the .inf file on request of the driver wizard. I'd like to "skip" this step (as it is usually for an already-installed driver) if possible.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
Has anyone ever encountered a crash when doing a StepOver in the debugger in VC6? VC6 just all of a sudden dies and closes. It seems the problem is getting worse and worse, and I haven't seen it on any other project but ours. Has anyone else seen this problem, and if so, any workarounds?
Thanks!
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
I think back on Win9x I used to see this, but not on W2K or WXP. What version of Windows are you using?
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Windows Xp Pro
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Swinefeaster wrote:
Has anyone else seen this problem, and if so, any workarounds?
Yes, i had such a problem in the past. Look here[^].
rechi
|
|
|
|
|
I want to create a HTML control using ATL Wizard. I tried creating it using the ATL HTML Control. But when i tried to test it (both in ActiveX test container and in browser) i am gettting the error 'Object doesn't support this property or method'. (when it tries to call 'OnClick' , i.e when i click the button called 'Red', 'Green', 'Blue') I tried in Win98 and WinXp. I use VC6.
Can any one help with what i can i do to get this working?
Thanx in advance.
Mahesh
|
|
|
|
|
#include "Windows.h"
#include "WinSpool.h"
#include "Winbase.h"
char* cube() {
char buff[1024];
GetProfileString("PrinterPorts",NULL,NULL,buff,sizeof(buff));
int length,j;
length=strlen(buff);
char *token;
char sep[]="|";
for (j=0;j<1024;j++)
{
if(buff[j]==NULL)
buff[j]='|';
}
token = strtok( buff,sep);
j=0;
HANDLE hPrinter=NULL;
PRINTER_INFO_2 *ppi2 = NULL;
BOOL bFlag;
unsigned long dwNeeded;
DWORD dWord;
long Status;
char *portnumber,*strName;
//DWORD dError;
while( token != NULL )
{
bFlag=OpenPrinter(token,&hPrinter,NULL);
dWord=GetLastError();
if(bFlag==1)
{
bFlag= GetPrinter(hPrinter,2,0 ,0,&dwNeeded);
ppi2 = (PRINTER_INFO_2 *)GlobalAlloc(GPTR, dwNeeded);
bFlag= GetPrinter(hPrinter,2,(LPBYTE)ppi2 ,dwNeeded,&dwNeeded);
if (bFlag==1)
{
return token;
Status=1;
Status=ppi2->Status;
portnumber=ppi2->pPortName;
strName=ppi2->pShareName;
//dError=GetLastError();
ClosePrinter(hPrinter);
exit(0);
}
}
// SetDefaultPrinter(token);
token = strtok( NULL, sep);
ClosePrinter(hPrinter);
}
token=NULL;
return token;
}
Hi can any one tell me whts wrong with the code. the status returned by PRINTER_INFO_2 is 0 every time. while the OpenPrinter and GetPrinter are returning 1 meaning successfully returning values of the printer. i dont no why everytime status is 0.
can any body help me out.
waiting for swift reply
|
|
|
|
|
I am using tabcontrols in a SDI application. on my toolbar i have buttons name "Play" and "Veiw Log" and down to toolbar i have tab controls, two buttons name "IP Statistics ", "Send Email". when i click the "Play" button the dialog opens which exist as property sheet under the tab button "IP Statistics". Now what i want is, the dialog which has been opened must be sized according to the parent window. something i know is, i have to do with onsize method of my view class. plz tell me the complete solution.
thanx Alot!
Reply me soon
|
|
|
|
|
First a comment about your post. Maybe i'm a little touchy but I do not think that posting a thread containing "immmediate help required" "plz tell me the complete solution" "Reply me soon" is the best way to get a quick answer. Replace it with "Resizing a dialog to my current view size" in the title, and "could you provide me with a small code snippet" would certainly help.
As for your problem, if you want your property sheet to be sized to your view, retrieve the cx and cy parameter from CWnd::OnSize(UINT nType, int cx, int cy ) and use them to calculate the new size of your property sheet, maybe with a MoveWindow(), or SetWindowPos().
~RaGE();
|
|
|
|
|
|
we can insert the user menuitem on the right click of the mouse in the browser(in the registry,i.e;MenuExt).I want the further code for adding the submenu to this usermenu item
|
|
|
|
|
Well, one way to do it is with a Browser Helper Object (BHO). You can find one such example here:
http://www.codeproject.com/useritems/PopupBlocker.asp[^]
Take a look at the screen shot, it's showing a popup menu off the context menu.
Chris Richardson
You can stash and you can seize
In dreams begin, responsibilities U2 - Acrobat[^]
Stop being PC and accounting for everyone and his momma's timeframe. Just enjoy your - Rohit Sinha in the content-challenged thread
|
|
|
|
|
How do i get it to were when someone clicks on the help menu, it opens a help file?
i used this code and it didn't work
<br />
case CM_HELP:<br />
WinHelp(NULL,"HELPFILE.HLP",HELP_HELPONHELP, 0L );<br />
|
|
|
|
|
Try this:
CString szHelpFile = "helpfile.hlp";
::WinHelp( m_hWnd, szHelpFile, HELP_FINDER, NULL );
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
Saying something "doesn't work" is vague at best. What doesn't work? Is it a compiler/linker error? Is an exception thrown? Does it start the help engine but not find the HLP file? Does it open the HLP file but fail to find the right topic?
|
|
|
|
|
I you have allocated an linked-list in the CView class, i want to know how to pass a pointer to it to the CDocument class, so you don't have to copy/transmit everything.
Please help me, this is driving me crazy. I have no clue of how doing the serialization. Each node in the list has only two CPoint members.
Sincerely,
Fernando
Fernando Jose Martinez Mendoza
Bucaramanga - Colombia
|
|
|
|
|
fermar84 wrote:
I you have allocated an linked-list in the CView class, i want to know how to pass a pointer to it to the CDocument class, so you don't have to copy/transmit everything.
Use: CDocument::GetFirstViewPosition() - GetNextView(pos) to iterate the views to get the one you need and then access you list. eg.
POSITION pos = GetFirstViewPosition();
while (pos != NULL)
{
CView* pView = GetNextView(pos);
pLL = pView->GetPtrToLinkedList();
...
}
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hi all,
How to broadcast a message within a LAN using Winsock? Meaning how to send a message to every machine in a local network without knowing their IP addresses, of course you do know the port you’re using. Like when games find all servers in a network without knowing they are there.
Aidman » over and out
|
|
|
|
|
You need to read up on Winsock. There are some articles here. As far as discovering other servers for a game environment etc. It depends on how each server is set up. For example, if the server is always listening for a connection on a particular port, it may be as simple as broadcasting a message to all IPs on that port and see which ones respond. Of course, there should already be an established protocol on how a game running on a client computer would do this.
But, sending a broadcast message is a connectionless datagram protocol such as UDP. Usually, you would send the message to IP broadcast address of 255.255.255.255 or your IP's subnet as xxx.xxx.xxx.255. If you read up on how to send a UDP network message, its simply a matter of putting the broadcast address as your destination address (the PC you're sending the message to).
|
|
|
|
|
If I use UDP to broadcast, Do I need to use the "setsockopt" function to set the "SO_BROADCAST" flag?
Aidman » over and out
|
|
|
|
|
Yes, you do. Here is a sample program I wrote to perform broadcast. It works on both Linux, Posix (for our embedded system), and Windows. For Windows, you need to #define WINMACHINE:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#ifdef WINMACHINE // for Windows
#include <windows.h>
#include <winsock.h>
#include <wincon.h>
#include <conio.h>
#else // for unix/POSIX
#include <machine/mpc823.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/errno.h>
#include <netinet/in.h>
#include <pthread.h>
#include <netinet/udp.h>
#endif
#define TXOUTBUFSZ 10000 // Output buffer size
#define RADAR_PORT 44068 // IP/UDP Port number for trans/rcv
#ifdef WINMACHINE // for Windows
WSADATA wsaData;
SOCKET sock;
SOCKADDR_IN dst_addr, src_addr;
int dst_addr_len = sizeof(dst_addr);
#else // for unix/POSIX
int sock;
struct sockaddr_in dst_addr, src_addr;
#endif
int rc;
int main()
{
char sampleMsg[132];
int optval = 1;
int optlen = sizeof(int);
dst_addr.sin_family = AF_INET;
dst_addr.sin_port = htons(RADAR_PORT);
dst_addr.sin_addr.s_addr = INADDR_BROADCAST;
strcpy(sampleMsg, "This is a test sample msg from the box. ");
#ifdef WINMACHINE // for Windows
rc = WSAStartup (MAKEWORD (1, 0), &wsaData);
if(rc != 0)
{
printf("Error starting WinSock\n");
goto error;
}
sock = socket(AF_INET,SOCK_DGRAM, 0);
if(sock == INVALID_SOCKET)
{
printf("Error creating receive socket\n");
goto error;
}
rc = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&optval, optlen);
if(rc == SOCKET_ERROR)
{
printf("Error setting up receive buffer\n");
goto error;
}
while(!kbhit())
{
printf("Sending data: %s Any key to quit.\n", sampleMsg);
rc = sendto(sock, sampleMsg, strlen(sampleMsg) + 1, 0, (struct sockaddr*) &dst_addr, sizeof(dst_addr));
if(rc == SOCKET_ERROR)
{
printf("Couldn't send data.\n");
goto error;
}
Sleep(1000);
}
closesocket(sock);
goto finish;
#else // for unix/POSIX
sysInit();
startNetwork();
if (setuid(0)== -1)
printf("setuid not eq root");
if ((sock = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
{
printf("Network socket initialization failed.\n");
fflush(stdout);
goto error;
}
rc = setsockopt(sock, SOL_SOCKET, SO_BROADCAST, (char *)&optval, optlen);
if(rc)
{
printf("Error setting up receive buffer\n");
goto error;
}
src_addr.sin_family = AF_INET;
src_addr.sin_port = htons(RADAR_PORT);
src_addr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(sock,(struct sockaddr*) &src_addr,sizeof (src_addr)) == -1)
printf("bind failed \n");
while(1)
{
printf("Sending data: %s Any key to quit.\n", sampleMsg);
if(sendto(sock, sampleMsg, strlen(sampleMsg) + 1, 0, (struct sockaddr*) &dst_addr, sizeof(dst_addr)) < 0)
{
printf("Error: could not send data. \n");
fflush(stdout);
goto error;
}
sleep(1);
}
goto finish;
#endif
finish:
printf("Done.\n");
return 0;
error:
#ifdef WINMACHINE
printf("\nsock Error in main(): %ld Hit any key\n", WSAGetLastError());
#else
printf("\nsock Error in main(): %ld Hit any key\n", errno);
#endif
getchar();
return 1;
}
|
|
|
|
|
GREAT THANKS!!!
really cool code =)
Aidman » over and out
|
|
|
|
|