将文件拖到文本框,然后出现文件名 [英] dragging a file to a textbox, and a filename appearing

查看:62
本文介绍了将文件拖到文本框,然后出现文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试设置一个部分,人们可以开始将
文件拖到文本框中,然后存储文件的完整位置。

MS -Dos内置了这个功能,它用C语言编写,所以它需要工作,我已经构建了一个接受文件的文本框:

hMsgBox = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES," EDIT",

"",

WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL,

15,30,420,20,hwnd,(HMENU)IDD_MSG_BOX,GetModuleHandle(NULL),

NULL);


我也有,在窗口的WM_command下,(默认情况下)一个

消息框,显示当前被忽略的消息。

当我将文件拖到文本框时,我得到下降箭头(光标

表示你​​允许丢弃)当我丢弃时我没有收到任何消息。

当我点击文本框时我收到一条消息,所以我知道它正在发挥作用。


继承人WM_COMMAND的代码:


默认值:

{

char m [15]; //一些随机数

sprintf(m,"%d",LOWORD(wParam));

MessageBox(hwnd,m," message",MB_OK) ;

}

休息;


请帮助。

I''m trying to have a section where people can just start dragging
files into a textbox and the full location of the file will be stored.
MS-Dos has this function built into it, and it''s written in C, so it
has to work, I''ve built a textbox that accepts files:

hMsgBox = CreateWindowEx(WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES, "EDIT",
"",
WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL,
15, 30, 420, 20, hwnd, (HMENU)IDD_MSG_BOX, GetModuleHandle(NULL),
NULL);

I also have, under the WM_command for the window, (for default) a
message box that displays the current message that is being ignored.
When i drag a file to the textbox i get the dropping arrow (the cursor
that says your allowed to drop) and when i drop i receive no message.
when i click on the text box i get a message, so i know it is working.

heres the code for the WM_COMMAND:

default:
{
char m[15]; //some random number
sprintf(m, "%d", LOWORD(wParam));
MessageBox(hwnd, m, "message", MB_OK);
}
break;

Please help.

推荐答案

在文章< e8 ********************************** @ f63g2000hsf。 googlegroups.com>,

jon< jm ****** @ hotmail.comwrote:
In article <e8**********************************@f63g2000hsf. googlegroups.com>,
jon <jm******@hotmail.comwrote:

>我是尝试有一个部分,人们可以开始将文件拖到文本框中,文件的完整位置将被存储。
MS-Dos内置了这个功能,并且已经写好了在C中,所以它必须工作,我已经构建了一个接受文件的文本框:
>I''m trying to have a section where people can just start dragging
files into a textbox and the full location of the file will be stored.
MS-Dos has this function built into it, and it''s written in C, so it
has to work, I''ve built a textbox that accepts files:



你所拥有的不是标准C,而是C带操作系统

或第三方扩展。


C代码中没有明显的错误*被视为纯C代码*,

所以你将不得不把你的问题带到新闻组

来处理你正在使用的OS库或扩展。

也许一个comp.msdos新闻组。


我建议你在那里提出问题时,你会更清楚你的问题是什么。你已经描述了一个行为

,但你似乎没有说出你想要的是什么以及发生了什么

。或者,如果你这么说,那么你的工具箱的术语就会被埋得太深了。

-

当我们都认为没有人在思考时。

- Walter Lippmann

What you have is not Standard C, but rather C with operating system
or third party extensions.

There is no -obvious- error in your C code *considered as pure C code*,
so you are going to have to take your question to a newsgroup
that deals with the OS libraries or extensions that you are using.
Perhaps one of the comp.msdos newsgroups.

I suggest that when you take your question there, that you be
more clear about what your question -is-. You have described a behaviour
but you do not appear to say what it is you want and what is happening
instead. Or if you are saying so, then it is buried too deep in
the jargon of your toolbox for me to make out.
--
"When we all think alike no one is thinking very much."
-- Walter Lippmann


- Walter Roberson />

我问你如何让文本框抓住文件的位置

掉进去。当我说丢弃时,我的意思是该文件是从资源管理器中拖出来的。到程序然后当

鼠标位于文本框顶部时释放。什么消息或通知我必须发送到文本框以使其抓取文件的位置。我是

寻找执行此操作的C代码,我猜它是在

windows.c库中,这是一个标准库。
-- Walter Roberson

I am asking how do you make a text box grab the location of the file
that is dropped into it. When i say dropped i mean that the file is
dragged from an "explorer" to the program and then released when the
mouse is over top of the text box. What message or notification do i
have to send to the text box to make it grab the file''s location. I am
looking for the C code that does this, I am guessing that it is in the
windows.c library which is a standard library.


在文章< 17 ********************************** @ m36g2000hse。 googlegroups.com>,

jon< jm ****** @ hotmail.comwrote:
In article <17**********************************@m36g2000hse. googlegroups.com>,
jon <jm******@hotmail.comwrote:

>我在问怎么样你做了一个文本框抓住放入其中的文件的位置。当我说丢弃时,我的意思是该文件是从资源管理器中拖出的。到程序然后当
鼠标位于文本框顶部时释放。我必须向文本框发送什么消息或通知才能使其获取文件的位置。我正在寻找执行此操作的C代码,我猜它是在
windows.c库中,这是一个标准库。
>I am asking how do you make a text box grab the location of the file
that is dropped into it. When i say dropped i mean that the file is
dragged from an "explorer" to the program and then released when the
mouse is over top of the text box. What message or notification do i
have to send to the text box to make it grab the file''s location. I am
looking for the C code that does this, I am guessing that it is in the
windows.c library which is a standard library.



windows C库不是标准库。它甚至没有通过单一的国家或国际标准认证

组织。


你的一些短语 - 建议 - 你试图在MS Windows机器上执行此操作
。例如,explorer是与MS Windows相关的
,通常在其他

操作系统中找不到。


你要求做什么不能在标准C中完成。标准C

(ANSI X3.159或ISO / IEC 9899)没有图形概念。


就像我之前所说的那样,你需要把你的问题带到一个新闻组

来处理你正在处理的操作系统或第三方库。

你正在拨打的电话没有打电话给你任何标准的C例程。

-

我认为沃尔特是一个非常聪明的人。 - Gene Autry

The windows C library is NOT a standard library. It has not been
certified through even a single national or international standards
organization.

Certain phrases in your sentances -suggest- that you are trying to
do this on an MS Windows machine. For example "explorer" is
associated with MS Windows, and is not generally found in other
operating systems.

What you are asking to do CANNOT be done in standard C. Standard C
(ANSI X3.159 or ISO/IEC 9899) have no concept of graphics.

Like I indicated before, you need to take your question to a newsgroup
that deals with the OS or third party library that you are dealing with.
The calls you are making are not calling upon any standard C routine.
--
"I think Walter was a very smart man." -- Gene Autry


这篇关于将文件拖到文本框,然后出现文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆