|
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
|
|
|
|
|
language problem.
if u defined a variable in a h file, such as int i0; then include the file by 2 cpp files, the result is similar to define int i0 in 2 cpp files (but not define in h file)- syntax error.
u can modify declare as
static int i0=0; (no good)
extern int i0; then difine in a cpp file as: int i0=0;
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.
-- modified at 11:01 Saturday 22nd April, 2006
|
|
|
|
|
|
In your project there is a file with name CMyDlg.cpp or something like that.
Just open it and declare your function there.
good luck
We Believe in Excellence
www.aqueelmirza.cjb.net
|
|
|
|
|
Either place the funcion/variable in the main code file or in its own file ( like 'Globals.cpp'). Then either place the declaration (prototypes) in the 'stdafx.h' file or include a header for the 'Globals.cpp' file in it.
If you are dealing with a single variable, just declare it in the main .cpp file and the declare it as external in the 'stdafx.h' file.
If you do not want to make it truely global (everyone knows about it), then declare it in one of the files that needs it and declare it as external in any other file that needs access to it.
INTP
Every thing is relative...
|
|
|
|
|
I maintain a very mature product (over ten years old) that was written in MSVS 6. My team is in the process of giving the app a new look and feel. We decided to try to convert the project to .net to leverage the GUI elements; but had too many issues during this process and forfeit the idea.
This leads to my questions:
1.Could an application that is compiled under MSVS 6 use Win Forms?
2.This is more of a secondary question to number 1). Could controls be written in C# then; built into an assembly; be used by an app compiled in MSVS 6?
3.If you answer yes to either question; is there any documentation?
Thank you ,
-e
-- modified at 8:33 Saturday 22nd April, 2006
|
|
|
|
|
-e wrote: 1.Could an application that is compiled under MSVS 6 use Win Forms?
no
-e wrote: 2.Could controls be written in C# then; built into an assembly; be used by an app compiled in MSVS 6?
no
-e wrote: 3.If you answer yes to either question; is there any documentation?
sorry
in fact, you can't because VC6 doen't know gthe .NET framework at all. so you can't neither use the .NET SDK, nor use some assembly compiled for .NET.
tell me however, why don't you just upgrade the code to VC++2003 (MFC or Win32) without wanting targetting for .NET ?
|
|
|
|
|
Thanks for the input.
To answer your question I had assigned developers to try to convert the application to VC++ 2003. Since the applications is over ten years old it has seen its share of GUI toolkits and some of these toolkits are not converting to the new platform. So one of my goals is to slowly move the application to the new platform. I am trying to make the application co-exist between VC ++ 6 (old code) and VC++ (maybe .net) 2003 or greater (new code). Since I don't have the option to compile the application greater than VC++ 6.
Thanks,
-e
|
|
|
|
|
MSVS is actually a studio and not specificaly intended for only C++. You are able to compile most languages using MSVS including C#, J#, C++, C. Maybe you meant to say MSVC?
It is possible to call C# code from C++. Usually the C# would be in the form of a dll, and you would need to manually register the type library. Also the .NET runtimes would need to be installed on the client machine. The process of doing this is a little complicated, but there are some articles here on CP which demonstrate it.
|
|
|
|
|
Thanks for replying,
I should of been more specific with the development language. The existing application is coded using VC++ 6 (MFC). At the moment I can't covert (promote) the existing code to a greater platform than VC++ 6 (for various reasons). So I am looking for a way to have new development be written in VC++ 2003(or higher) or C# and try to co-exist with the existing code. So I guess what I'm looking for is an application that is compiled with VC++ (MFC) 6 to have mixed code; the existing code to use MFC 6 components (like dialogs etc..) and the new code to use C#, VC++ 7 code (like Win-Forms etc...).
Thanks,
-e
P.S. My goal is to eventually move the application to the newer platform (in baby steps).
|
|
|
|
|
I've done this via Com Callable Wrappers (CCW) around .NET components.
This[^] article is a good starting point.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|