|
Other than the fact you are starting with intLineSize set equal to intWrapSize, instead of 0, I do not not see the problem. I am looking at you your code and I feal like the is something wrong. I do not know what it is (at 4:28 AM), but it is there.
Trust in the code Luke. Yea right!
|
|
|
|
|
Hi,
does anybody know how to implement a multiline list view? I need list items which are 2 or 3 lines high. \n, \r\n and \r\r\n don't work.
Regards,
Happosai
------------------------------------
http://www.happosai.tk
|
|
|
|
|
Try this article http://www.codeproject.com/listctrl/lvcustomdraw.asp the last pic in the article has a multi line list.. I haven't gone through the code but it may be a place to start..
Rob
Whoever said nothing's impossible never tried slamming a revolving door!
|
|
|
|
|
Hi,
sure, it's a place to start, but not for a beginner like me "I achieved this by doing all the painting on my own." That's too hart for me but thanks anyway.
Regards
Happosai
------------------------------------
http://www.happosai.tk
|
|
|
|
|
Is there a way that you can open solitare through a C++ command and if there is what is it?
Thanks
Matt
Matt Millican
http://www.internetmill.com
|
|
|
|
|
InternetMill wrote:
Is there a way that you can open solitare through a C++ command and if there is what is it?
Try the ShellExecute function.
-Nick Parker
|
|
|
|
|
Not with C++ (it knows nothing about launching applications). With the Windows SDK, you can use WinExec (not recommended), ShellExecute, or CreateProcess.
|
|
|
|
|
Hi, working on an instalation project and would like to know if there is any safe way to install a .inf file with some C++ code, for win 95, 98, NT4, 2k and XP.
The problem is that I have a USB device and would like to install the driver for it witout the need for the device to be inserted into the computer.
regards ME
|
|
|
|
|
Yes.
I am not sure why you need to install an .ini file(assume .inf was a mistake). But you need to not only copy the driver to the %windir%\system32\drivers directory you need to modify the registry (so it knows it exist).
Note: None of the above can be done on WinNT/Win2000/WinXp unless an Adiminstrator is doing the install.
Trust in the code Luke. Yea right!
|
|
|
|
|
I want to add new records with my program to my database
but I don't know how to do this .
please help me.
|
|
|
|
|
Are you wanting to know how to use CRecordset::AddNew()?
|
|
|
|
|
yes I want to know how can I use this method in a dialog base application . please give me an example
|
|
|
|
|
Have you checked out MSDN, or Googled for examples?
|
|
|
|
|
yes but I cann't find something that help me.
try
{
//update the current record
//CGuard obj;
piAdoRecordBinding->Update(&rsRecSet);
//can we add a new record?
if(m_pRs->Supports(adAddNew))
{
piAdoRecordBinding->AddNew(&rsRecSet);
}
is it correct
|
|
|
|
|
|
In this case AddNew is done through the CADORecordsetBinding class and since you don't know much about this subject, you should not use this method (until you improve your ADO skills) because it is not that straight forward. On the other hand, database programing is something that takes a couple of weeks at least to understand, so just by looking at examples won't work.
// Afterall I realized that even my comment lines have bugs
|
|
|
|
|
|
I have the following annoying thread problem
A message is handled in my dialog class.
Call AfxBeginThread() with a static stub method as the thread entry point, passing a this pointer in.
Call ( (CMyClass*) arg)->MyThreadEntryPoint to get back into the class scope.
Now, back in my class member function, one of the first lines is UpdateData( true ). This crashes with a memory error. Is that not a legal way of using threads? I guess there are then two threads working in the same class, if that's a problem.
If possible I want to avoid deriving from CWinThread. This is a worker thread, btw.
Thanks
Dave
|
|
|
|
|
Since it is a worker thread, it cannot be doing anything with the UI, at least with any hope of success. It appears that MyThreadEntryPoint() is the worker threads' way of "sneaking" back into the dialog's thread. If the worker thread must do anything with the UI, it must use PostMessage() to the main thread.
|
|
|
|
|
DavidCrow you are a true *.
|
|
|
|
|
Hi,
I have a C++ DLL question. I want to have two functions as follows in a DLL.
namespace View
{
long _stdcall MakeWindow();
long _stdcall RegisterClass();
}
Is it possible to use it in this form from VB. So, can I call these functions in VB ...something like View::MakeWindow(). My knowledge of VB and C++ for that matter is very basic and any help would be appreciated.
Also, I had another funny experience. I cannot export a void function. I know I am missing something and being really stupid. If I have a C++ function like:
void _stdcall someFunc()
{}
and I declare it in VB as:
Declare Function someFunc Lib "C:\BOXDLL.dll" ()
I get a bad DLL calling convention error, but if I declare it as long
long _stdcall someFunc()
{
return someVal;
}
and I declare it in VB as:
Declare Function someFunc Lib "C:\BOXDLL.dll" () As Long... this works. However, how can I tell VB that the function is of type void.
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hi,
Ok figured out why I could not export void functions. I had to declare it as:
Declare Sub someFunc Lib "C:\BOXDLL.dll" () instead of Function. This is a very weird arrangement in my opinion.
Still no luck with exporting namespaces. Any help there would be greatly appreciated!
Thanks,
Pankaj
Without struggle, there is no progress
|
|
|
|
|
Hi, everyone!
Here is a piece of code which is simply shows the usage of RAW socket. When capturing the package with Ethereal, it is often said bogus TCP header length (0, must be at least 20).
Please see what is wrong with my program.
Source code:
--------
/********************** main.c source file ************************/
#include <winsock2.h>
#include <windows.h>
#include <ws2tcpip.h>
#include <stdio.h>
#pragma comment(lib, "ws2_32.lib")
struct tcpheader {
unsigned short int th_sport;
unsigned short int th_dport;
unsigned int th_seq;
unsigned int th_ack;
unsigned char th_x2:4, th_off:4;
unsigned char th_flags;
unsigned short int th_win;
unsigned short int th_sum;
unsigned short int th_urp;
}; /* total tcp header length: 20 bytes (=160 bits) */
struct ipheader {
unsigned char ip_hl:4, ip_v:4; /* this means that each member is 4 bits */
unsigned char ip_tos;
unsigned short int ip_len;
unsigned short int ip_id;
unsigned short int ip_off;
unsigned char ip_ttl;
unsigned char ip_p;
unsigned short int ip_sum;
unsigned int ip_src;
unsigned int ip_dst;
}; /* total ip header length: 20 bytes (=160 bits) */
// IP/TCP/UDP Checksum Function
USHORT checksum(USHORT *buffer, int size)
{
unsigned long cksum=0;
while (size > 1)
{
cksum += *buffer++;
size -= sizeof(USHORT);
}
if (size)
{
cksum += *(UCHAR*)buffer;
}
cksum = (cksum >> 16) + (cksum & 0xffff);
cksum += (cksum >>16);
return (USHORT)(~cksum);
}
#define PORT 25
int main (void)
{
WSADATA wsd;
char datagram[4096];
int bOpt = 1;
if (WSAStartup(MAKEWORD(2,2), &wsd) != 0)
{
printf("WSAStartup() failed: %d\n", GetLastError());
return -1;
}
// Create a raw socket
SOCKET s = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
if (s == INVALID_SOCKET)
{
printf("WSASocket() failed: %d\n", WSAGetLastError());
return -1;
}
struct ipheader *iph = (struct ipheader *) datagram;
struct tcpheader *tcph = (struct tcpheader *) datagram + sizeof (struct ipheader);
struct sockaddr_in sin;
sin.sin_family = AF_INET;
sin.sin_port = htons (PORT);
sin.sin_addr.s_addr = inet_addr ("2.3.4.5");
memset (datagram, 0, 4096); /* zero out the buffer */
iph->ip_hl = 5;
iph->ip_v = 4;
iph->ip_tos = 0;
iph->ip_len = sizeof (struct ipheader) + sizeof (struct tcpheader);
iph->ip_id = 1;
iph->ip_off = 0;
iph->ip_ttl = 255;
iph->ip_p = 6;
iph->ip_sum = 0;
iph->ip_src = inet_addr ("1.2.3.4");
iph->ip_dst = sin.sin_addr.s_addr;
tcph->th_sport = htons (1234);
tcph->th_dport = htons (PORT);
tcph->th_seq = rand();
tcph->th_ack = 0;
tcph->th_x2 = 0;
tcph->th_off = 5;
tcph->th_flags = 2; // SYN
tcph->th_win = htons(65535);
tcph->th_sum = 0;
tcph->th_urp = 0;
iph->ip_sum = checksum((unsigned short *)&iph, sizeof(ipheader) >> 1);
if (setsockopt(s, IPPROTO_IP, IP_HDRINCL, (char *)&bOpt, sizeof(bOpt)) == SOCKET_ERROR)
{
printf("setsockopt(IP_HDRINCL) failed: %d\n", WSAGetLastError());
return -1;
}
while (1)
{
// Send The Packet
if (sendto(s, datagram, 40, 0, (SOCKADDR *)&sin, sizeof(sin)) == SOCKET_ERROR)
{
printf("sendto() failed: %d\n", WSAGetLastError());
return -1;
}
}
return 0;
}
/********************** main.c source file ************************/
--------
Thanks in advance,
George
|
|
|
|
|
Well, I've never done Raw before so I'm not sure how it's supposed to look but I changed:
George2 wrote:
struct tcpheader *tcph = (struct tcpheader *) datagram + sizeof (struct ipheader);
to this:
struct tcpheader *tcph = (struct tcpheader *) (datagram + sizeof (struct ipheader));
And here's what my sniffer captured, 2 frames:
5/01/2003 10:39:24 PM.7860
0000: 00 04 5A 20 E1 61 00 03 2F 07 5B 57 08 00 45 00 ..Z áa../.[W..E.
0010: 00 28 01 00 00 00 FF 06 B0 C2 01 02 03 04 02 03 .(....ÿ.°Â......
0020: 04 05 04 D2 00 19 29 00 00 00 00 00 00 00 50 02 ...Ò..).......P.
0030: FF FF 00 00 00 00 ÿÿ....
05/01/2003 10:39:25 PM.7256
0000: 00 04 5A 20 E1 61 00 03 2F 07 5B 57 08 00 45 00 ..Z áa../.[W..E.
0010: 00 28 01 00 00 00 FF 06 B0 C2 01 02 03 04 02 03 .(....ÿ.°Â......
0020: 04 05 04 D2 00 19 29 00 00 00 00 00 00 00 50 02 ...Ò..).......P.
0030: FF FF 00 00 00 00 ÿÿ....
Is that the way it's supposed to look?
|
|
|
|
|
I have a console application but I don't want that black window appear.I don't need to show anything to user.How can I prevent appearing it?
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|