|
Yes, you Must on Pain of your program no longer responding!
You should ALWAYS call the Default procedure appropriate for your window.
The way windows works, is, it sends messages, thousands of them. A Window Procedure gives you a chance to act on selected messages. (Each Key Press, or Mouse Move will send a Message to your procedure, which in most cases you would not want to handle. if you do not pass them on, the keyboard and mouse will stop to function as soon as you put the mouse in the window. ) As a matter op protocol, you should pass on any messages you do not handle down the chain, for someone else to pick up and handle. You do this by calling the Default Procedure. Windows will take care of despatching your unhandled messages ( which are most) to the next in the chain.
Note: DefWindowProc(...)is the procedure for generic windows. Dialogs and Controls have different default procedures.
LateNightsInNewry
|
|
|
|
|
farshad.f wrote: i wanna...retrieve some information from a mail...
What mail?
farshad.f wrote: should i create a protocol to write my mail in that way?
I doubt it since other protocols (e.g., SMTP) already exist?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
hi and a big hello!
i wanna code a new server to control a pc.but with abiliy to be upgrated in future.does anybody know about plugin?
how can i use it in my program?
-- modified at 12:49 Saturday 22nd April, 2006
|
|
|
|
|
Can anyone tell me the differences between *.doc and *.txt file format. How can we access the plain text in the *.doc file format.
HelpMe
|
|
|
|
|
|
*.txt is a plain text file where the characters are stored in plain ASCII format. You can read these files with fstream.
*.doc is a Compound file commonly used by the MS Word application. This files contains various formatting instructions aswell as text. The easiest way to read is by using Word Automation.
|
|
|
|
|
beardy janggut wrote: Can anyone tell me the differences between *.doc and *.txt file format.
Since a file can have any extension regardless of what it contains, it's impossible to say. You can save a file in Notepad with a .doc extension just as you could save a file in Word with a .txt extension. A file's name and contents are only relevant to the application that created it.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
How to implement the dirctory enumerator for the directory having files with the path length more than 260 bytes?.
WIN32_FIND_DATA structure used in the FindNextFile() limits the cFileName to MAX_PATH which is defined as 260.
If we are trying to implement the directory enumerator for the Japanese language, then it is quite possible to have paths beyond 260 bytes.
During that time, FindNextFile will fail to get the elements.
Please let me know for any work around for the same.
Thanks in advance
-Sandeep
|
|
|
|
|
Instead of using MAX_PATH use a Unicode string.
|
|
|
|
|
A Unicode app can create a file with a full path longer than MAX_PATH characters, but cFileName is not the full path, it's just the name+extension of whatever was found. This cannot exceed MAX_PATH TCHAR s.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters).
If we take the japanese OS, file name and extenstion with 150 characters can take more than 300 bytes. This is something cFileName cannot handle I think.
Any suggetions on this front?.
Thanks in advance
Sandeep
|
|
|
|
|
Sandeep. Vaidya wrote: Windows allows to create the file names beyond 260 bytes ( allows upto 255 characters).
How are you doing this? I'm unable to do it in Explorer, and the docs on file names[^] say each component of the full path can't exceed MAX_PATH characters (note: unicode characters, not bytes).
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
I Have a folder folder1 created in the desktop in Japanese OS. I have folder2 created inside folder1. Length of the full path for folder2 is 244 characters ( not bytes). It has some files also and the complete path is within the 260 characters ( not bytes).
If I start the enumeration on the top folder i.e folder1, I get the next file sproperly for all other files. when it comes to folder2, FindNextFile() return zero.
I tried the GetLastError() and found that it is not ERROR_NO_MORE_FILES.
|
|
|
|
|
Hi,
I'm trying to build an CDialog application that will connect to an ODBC database through another connecting application.
The connecting application is build, but now I need an CDialog application that will connect to the database through the connecting application, and execute some queries.
(I hope it gives meaning )
Thus, my problem is, how can I get the dialog to connect to my application , and respectively to the database?
Hope someone can suggest something.
P.S.: I am new to VC++, thus be specific with the replays.
Thanks
|
|
|
|
|
1.simplify question as how to communication between 2 apps - there are may ideas to do that: pipe, COM etc.
2.it is not a good idea to transfer huge data (records etc) between 2 apps.
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
if you are using MS visul c++ and select MFC AppWizard (exe) in project tab then select dialog based application and move forward. there will be a option like include database support or something like that. I am not sure as i am not able to open MS visual c++ at this time. Just check it. It is very easy as you have to just follow the instructions written there.
Good luck
If there is anyone who can explain this process in detail please reply.
We Believe in Excellence
www.aqueelmirza.cjb.net
-- modified at 16:03 Saturday 22nd April, 2006
|
|
|
|
|
Aqueel wrote: if you are using MS visul c++ and select MFC AppWizard (exe) in project tab then select dialog based application and move forward. there will be a option like include database support or something like that.
Better check again. This is only available with SDI and MDI applications.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb
|
|
|
|
|
Thank you David for correcting me. At that time, i was not able to varify it that's why i wrote that if someone else can explain it, please reply. Now i have checked and you were right. I think now gteodora gets some hint.
Thank you again.
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
I have an application that hooks startdoca, startdocw, enddoc, startpage and endpage api's, however when using Microsoft Word (winword.exe) startdoca/w does not get called, anyone know what other api is starting the printing process ?
Using APISPY32 from Matt Pietrek I can see that startpage/endpage and enddoc are being called but no startdoca/w, what gives ?
Notepad for example has a startdocw call why not winword anybody know ?
|
|
|
|
|
Solved it ... word (winword.exe) calls ExtEscape - why I do not know!
|
|
|
|
|
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdio.h>
#define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
#define BUFFER_SIZE 65535
#pragma comment(lib, "ws2_32.lib")
#define PROTOCOL_STRING_ICMP_TXT "ICMP"
#define PROTOCOL_STRING_TCP_TXT "TCP"
#define PROTOCOL_STRING_UDP_TXT "UDP"
#define PROTOCOL_STRING_SPX_TXT "SPX"
#define PROTOCOL_STRING_NCP_TXT "NCP"
#define PROTOCOL_STRING_UNKNOW_TXT "UNKNOW"
//……
char* GetProtocolTxt(int Protocol)
{
switch (Protocol){
case IPPROTO_ICMP : //1 /* control message protocol */
return PROTOCOL_STRING_ICMP_TXT;
case IPPROTO_TCP : //6 /* tcp */
return PROTOCOL_STRING_TCP_TXT;
case IPPROTO_UDP : //17 /* user datagram protocol */
return PROTOCOL_STRING_UDP_TXT;
default:
return PROTOCOL_STRING_UNKNOW_TXT;
}
}
typedef struct _TCP{ WORD SrcPort; // 源端口
WORD DstPort; // 目的端口
DWORD SeqNum; // 顺序号
DWORD AckNum; // 确认号
BYTE DataOff; // TCP头长
BYTE Flags; // 标志(URG、ACK等)
WORD Window; // 窗口大小
WORD Chksum; // 校验和
WORD UrgPtr; // 紧急指针
} TCP;
typedef TCP *LPTCP;
typedef TCP UNALIGNED * ULPTCP;
typedef struct _IP{
union{ BYTE Version; // 版本
BYTE HdrLen; // IHL
};
BYTE ServiceType; // 服务类型
WORD TotalLen; // 总长
WORD ID; // 标识
union{ WORD Flags; // 标志
WORD FragOff; // 分段偏移
};
BYTE TimeToLive; // 生命期
BYTE Protocol; // 协议
WORD HdrChksum; // 头校验和
DWORD SrcAddr; // 源地址
DWORD DstAddr; // 目的地址
BYTE Options; // 选项
} IP;
typedef IP * LPIP;
typedef IP UNALIGNED * ULPIP;
void main()
{
WSADATA WSAData;
SOCKET sock;
BOOL flag=true;
char LocalName[16];
struct hostent *pHost;
struct sockaddr_in addr_in;
char RecvBuf[BUFFER_SIZE];
IP ip;
TCP tcp;
/////////////////////////////////////////////////////////////有问题!!!!!!!!!
// 检查 Winsock 版本号,WSAData为WSADATA结构对象
WSAStartup(MAKEWORD(2, 2), &WSAData);
// 创建原始套接字
sock = socket(AF_INET, SOCK_RAW, IPPROTO_RAW);
// 设置IP头操作选项,其中flag 设置为ture,亲自对IP头进行处理
setsockopt(sock, IPPROTO_IP, IP_HDRINCL, (char*)&flag, sizeof(flag));
// 获取本机名
gethostname((char*)LocalName, sizeof(LocalName)-1);
// 获取本地 IP 地址
pHost = gethostbyname((char*)LocalName);
printf("我的主机 %s\n",pHost->h_name);
// 填充SOCKADDR_IN结构
addr_in.sin_addr = *(in_addr *)pHost-> h_addr_list[0]; //IP
addr_in.sin_family = AF_INET;
addr_in.sin_port = htons(57274);
// 把原始套接字sock 绑定到本地网卡地址上
bind(sock, (PSOCKADDR)&addr_in, sizeof(addr_in));
// dwValue为输入输出参数,为1时执行,0时取消
DWORD dwValue = 1;
// 设置 SOCK_RAW 为SIO_RCVALL,以便接收所有的IP包。其中SIO_RCVALL
// 的定义为: #define SIO_RCVALL _WSAIOW(IOC_VENDOR,1)
ioctlsocket(sock, SIO_RCVALL, &dwValue);
while (true)
{
// 接收原始数据包信息
int ret = recv(sock, RecvBuf, BUFFER_SIZE, 0);
printf("haha\n");
if (ret > 0)
{
// 对数据包进行分析,并输出分析结果
ip = *(IP*)RecvBuf;
tcp = *(TCP*)(RecvBuf + ip.HdrLen);
printf("协议: %s\r\n",GetProtocolTxt(ip.Protocol));
printf("IP源地址: %s\r\n",inet_ntoa(*(in_addr*)&ip.SrcAddr));
printf("IP目标地址: %s\r\n",inet_ntoa(*(in_addr*)&ip.DstAddr));
printf("TCP源端口号: %d\r\n",tcp.SrcPort);
printf("TCP目标端口号:%d\r\n",tcp.DstPort);
printf("数据包长度: %d\r\n\r\n\r\n",ntohs(ip.TotalLen));
}
}
}
The above is the program coding .
I write the sentence "printf("haha\n");" to debug the program !!!
But the recv method can't return an value , and nothing to do but wait.
How to solve it ? And why it will perform like that???
Thank you very much!!!
Jeff Fan
No change is the worst!!!
The principal of mine
msn:fyr000000@hotmail.com
If you like coding , add me.
-- modified at 9:35 Saturday 22nd April, 2006
|
|
|
|
|
I write the sentence "printf("haha\n");" to debug the program !!!
But the recv method can't return an value , and nothing to do but wait.
How to solve it ? And why it will perform like that???
Thank you very much!!!
Jeff Fan
No change is the worst!!!
The principal of mine
msn:fyr000000@hotmail.com
If you like coding , add me.
|
|
|
|
|
If dont want Recv to be blocked, use fcntl call to set the time out. So that Recv will not block and wait.
|
|
|
|
|
|
Hi Folks,
I need your help over an issue,
At what place in an "MFC App Wizard Application(exe)"
The Global varible/function should be defined. So that it is accessible through out the code..
I actully have an issue where i am trying to access Global Function in a cpp file (that was included to the current project,I wrote it for another project )
I compilation issues an Error saying
"Undelared Identifier"
but when i Add that function to my class the Linker error goes like
"Already defined in view.obj"
Got the idea ?
waiting for your response..
JinBaba
|
|
|
|