|
Not quite I think. It's more like :-
At the start of drag and drop create the text into a Word-Format and optionally a generic format.
Link both texts to the clipboard as alternative formats for a dynamic item
Perform an automatic Paste into the Word-Document which will grab the Word-Format text from the clipboard by default
If it's not Word it'll grab the generic text 'cause it can't handle the Word-Format text but only if you supply it in a generic format, otherwise it will see no content, paste will be disabled.
That way you don't have to identify the target app at all which is a kind of iffy thing to do.
It does sound quite ambitious for an MFC beginner. It freaked me out the first time I debugged some Clipboard code and of course with the Clipboard locked Cut/Copy and Paste stops working in the Debugger Made me realize how much I use it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Perform an automatic Paste into the Word-Document
That way you don't have to identify the target app at all
How can i perform the automatic paste into word from out my own application without knowing where the paste should be performed?
|
|
|
|
|
Because it's automatic. Word is already a drop target. Microsoft implemented it for you but what they do when you drop something on Word is going to depend on what type of data it's linked to, file, Word format text, plain text, image etc.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Oha! Nice
OK, i'll try it in some weeks.
Big thanks for your explains
|
|
|
|
|
I have an data-acquisition application in which data-logging is
performed constantly and data is stored in a CF Card, which acts as the primary data-storage device for the system.
The Windows CE image that i have loaded has support for automatic
detection of USB mass storage devices.
The User can retrive the data from the system (CF Card) thru USB Drive.
There is no screen or console , it is an industrial Controller.
The data acquistion goes on constantly , and the applicaiton
periodically polls the USB slot to see if the user has inserted any
USB Drive in it.
For this, i use the standard CreateFile() function in order to detect
if the user has inserted USB Pen Drive into USB slot or not. I get the
handle to the device using CreateFile(), is user has inserted it.
If he has, then all reqd. data from the CF Card is copied to the USB drive.
if ((hFile=CreateFile(_TEXT"DSK2:",GENERIC_WRITE,
FILE_SHARE_READ|FILE_SHARE_WRITE, NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL))!=INVALID_HANDLE_VALUE)
{Do further processing}
NOTE: Here DSK2: is the disk number of the Pen Drive
Whenever the user insertes the USB Drive, the OS detects this, and
CreateFile function therefore returns successfully with the USB dive
handle. Thus, USB Drive is detected.
Now, the problem is that sometimes, although the Pen Drive is
inserted, it is not detected by the OS, whearas at other times it is.
That is, in the Windows Explorer, where I can see the CF Card mounted
as "Hard Disk" and USB Pen Drive as "Hard Disk2", sometimes, this
"Hard Disk2" is not seen. It leads me to the conclusion that the USB
Dive is not mounted by the Windows Device Manager. Even if i remove the Pen Drive and re-insert it, it will not be detected hence-forth , once it is not detected. I don't know how to make the OS detect it then , the only way i know is rebooting the system. (Which is definetely not the solution!!)
What can possibly be causing this irregular behavior?
At such times, I cannot obtain a handle to the device using
CreateFile. Is there any alternate way to obtain access to the USB
device, rather than relying on Windows OS, and the Device Manager??
I have also completely checked the hardware, to verify that there is
no problem on hardware side, no loose connections etc. Another
important point is that the LED on the USB Pen Drive always glows when
I insert the Pen Drive, even when it is not detected by Windows CE.
Regrds,
CR
|
|
|
|
|
|
Hey Mathew
Thanks for ur inputs.
Can u give me further details about what WiCE OS version yours was. I m using Win CE 5.0, and hv just downloaded the patches yesterday.
Meanwhile, I tried to get the low level descriptor on CF and USB,but without any luck. I tried using FindFirstStore , FindNextStore functions but they give me the device name nicely, but not the device type...I am getting some garbage value in StoreInfo.dwDeviceType.
this is my source code:
STOREINFO SI;<br />
HANDLE hStore;<br />
int err=0;<br />
<br />
SI.cbSize=sizeof(STOREINFO);<br />
hStore=FindFirstStore(&SI);<br />
if (hStore!=INVALID_HANDLE_VALUE)<br />
{<br />
<br />
while(1)<br />
{ <br />
printf("Device type :\n");<br />
switch (SI.dwDeviceType)<br />
{<br />
case STORAGE_DEVICE_TYPE_PCIIDE :<br />
printf("1\n");<br />
case STORAGE_DEVICE_TYPE_FLASH :<br />
printf("2\n");<br />
case STORAGE_DEVICE_TYPE_ATA :<br />
printf("3\n");<br />
case STORAGE_DEVICE_TYPE_ATAPI :<br />
printf("4\n");<br />
case STORAGE_DEVICE_TYPE_PCCARD :<br />
printf("5\n");<br />
case STORAGE_DEVICE_TYPE_CFCARD :<br />
printf("6\n");<br />
case STORAGE_DEVICE_TYPE_SRAM :<br />
printf("7\n");<br />
case STORAGE_DEVICE_TYPE_DVD :<br />
printf("8\n");<br />
case STORAGE_DEVICE_TYPE_CDROM :<br />
printf("9\n");<br />
case STORAGE_DEVICE_TYPE_USB :<br />
printf("10\n");<br />
case STORAGE_DEVICE_TYPE_1394 :<br />
printf("11\n");<br />
case STORAGE_DEVICE_TYPE_DOC :<br />
printf("12\n");<br />
case STORAGE_DEVICE_TYPE_UNKNOWN :<br />
printf("13\n");<br />
case STORAGE_DEVICE_TYPE_REMOVABLE_DRIVE :<br />
printf("14\n");<br />
case STORAGE_DEVICE_TYPE_REMOVABLE_MEDIA :<br />
printf("15\n");<br />
default:<br />
printf("Not identified - %lu\n",SI.dwDeviceType);<br />
}<br />
<br />
printf("Device Name : %S\n",SI.szDeviceName);<br />
printf("Store Name : %S\n",SI.szStoreName);<br />
<br />
if (FindNextStore(hStore,&SI)==FALSE)<br />
{<br />
err=GetLastError();<br />
printf("No more devices - %d\n",err);<br />
FindCloseStore(hStore);<br />
break;<br />
}<br />
}<br />
}<br />
else<br />
{<br />
int err=GetLastError ();<br />
printf("Could not get the handle! - error %d\n",err);<br />
<br />
}
And these are the results:
<br />
Device Name : DSK1:<br />
Store Name : IDE Hard Disk Drive<br />
Device Type : <br />
Not identified - 215290179 <br />
<br />
Device Name : DSK2:<br />
Store Name : USB Hard disk Drive<br />
Device Type : <br />
Not identified - 215290179
|
|
|
|
|
Sorry to take so long to reply, have been away for nearly a week until yesterday.
Yes we use CE 5 but as you know everyone builds their own with CE so it may or may not be much similar to yours. The device names you're seeing are coming from the driver layer. If you've not written the driver yourself then these are probably ones that came with your Board Support Package. I don't deal with anything below the level of Platform Builder options for our products I'm afraid so I can't tell you much about how the drivers work. Ours are at least somewhat customised. I used various 3rd party Disk analysis tools on an ordinary Win XP PC to examine the CF card low level descriptors and discovered the unreported manufacturing change from Removable to Fixed. Our CE drivers had started reporting CF cards as 'IDE Hard Disk' which caused all sorts of havok. Our supplier at the time Pretec were very reluctant to admit to it and eventually claimed it is something going on throughout the industry.
At least you've been able to get the name for DSK2 and it is recognizably a USB disk. If you take USB to equate to removable, which I suppose depends on your hardware, then you've found it. To get any more and better particulars I guess you'll probably have to dive into the driver layer. Good luck
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Hi guys,
I have a problem that I need to call a 32-bit DLL from 16-bit Windows program. Is there is way to do this then kindly suggest and help me.
Thanking You !
Amitabh Mishra
|
|
|
|
|
I played around with "thunking" about 15 years ago. It hasn't crossed my mind since. What exactly are you looking for?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: "thunking"
Whoa - there's a word I haven't heard or used in a long long time
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
Hi
<br />
CList<class Customer> ListCustomers;<br />
<br />
Customer * pJohn = new Customer("John");<br />
Customer * pMary = new Customer("Mary");<br />
ListCustomers.AddTail(pJohn);<br />
ListCustomers.AddTail(pMary);<br />
Question is, should I manually delete allocated memory?
Thanks
devy
|
|
|
|
|
Yes, when you remove the element for the list, you should delete the memory. But you should do that only when the element is removed from the list.
|
|
|
|
|
Thanks... so I should do this?
<br />
CList ListCustomers;<br />
<br />
Customer * pJohn = new Customer("John");<br />
Customer * pMary = new Customer("Mary");<br />
ListCustomers.AddTail(pJohn);<br />
ListCustomers.AddTail(pMary);<br />
<br />
delete pJohn;<br />
pJohn = NULL;<br />
delete pMary;<br />
pMary = NULL;<br />
ListCustomers.RemoveAll();<br />
devy
|
|
|
|
|
In general, you add elements to the list and you don't keep the pointers to each individual elements (otherwise, why would you use a list ??). So, when you want to empty the list, you don't have those pointers directly but they are stored in the map. What you have to do is just iterate through your list and delete each item in the list and then call RemoveAll.
In other situations, it can also happen that you want to remove only one element from your list. Then, you simply delete this element and remove it from the list.
Hope that helps
|
|
|
|
|
I have a Resource file from where Dialog takes the static content that i want to display.
say LTEXT "Select",IDC_STATIC,....
where "Select" would gets displayed on to the dialog box on pop up
But I don't wanna do this way ...
Wat i want is smthng like
LTEXT str_Data,IDC_STATIC,...
where
str_Data is of type CString and gets its value from a function
say...
str_Data = getData("Select");
and Function is CString getData(LPCTSTR);
or sumthng like #define str_Data
and LTEXT str_Data,IDC_STATIC,...
and the rest remains same as above
Do , anyone has any idea...
|
|
|
|
|
I dont understand what do you need?you have a file and you want to display content of this file with a static control,right?
|
|
|
|
|
In VC++, you have a Resource file which has all the information regarding what ur dialog will contain , sumthng like this
LTEXT "Click View ",IDC_STATIC,54,73,145,11
PUSHBUTTON "View Information",IDC_VIEW,254,165,56,16
Wat i want is instead of putting "Click View" in this file , can i declare a variable CString str_Data which gets its value from a function
smthng like str_Data = FetchData(LPCTSTR);
so wat i mean is :
LTEXT str_Data, IDC_STATIC,54,73,145,11
|
|
|
|
|
sorry for my poor English .
It can't use variable directly in Resource file . If you want to do that , you can use a static content which ID isn't IDC_STATIC , and use SetWindowText to contrl the static content that you want to display in the dialog CPP.
LTEXT "Select",IDC_STATIC_NAME,....
...
//dialog cpp
...
GetDlgItem(IDC_STATIC_NAME)->SetWindowText("...");
|
|
|
|
|
That's quite easy...
(Step 1) Change the ID of your static control to something other than IDC_STATIC . For example IDC_MY_TEXT .
(Step 2) You can set the text of your static control programatically at any place in your code (e.g. in OnInitDialog() ) with the following method:
SetDlgItemText(IDC_MY_TEXT, "Here goes your text!"); The text can surely be a CString instance or the return value of your getData() method.
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
Thanx ....
n wat abt Resource File ... do i have 2 make sum changes in that ....
in LTEXT "",IDC_MY_TEXT,....
|
|
|
|
|
Sorry... what's your question? Please try to write valid English!
Perhaps you meant something completely different but... you don't have to change your resource file (.rc and/or resource.h) by hand. I guess you're using Visual Studio. Open the dialog that contains the static control, select the static with the mouse and enter the new ID for the static in the properties window. Press return, that's it. Visual Studion changes your resource files (.rc and resource.h).
Now you can use SetDlgItemText() to programmatically change the text of the static (see my previous post).
cheers,
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|
|
I dont think you can open MSMQ with send & recv permissions simultaneously. but there are somethers= sharemode permissions you can check in MSDN.
|
|
|
|
|
Hi all,
i am making a sdi application in which i have made a static splitter control.
i have made 2 views to allocate to parts made by splitter control.i have derived those two classes from CListView and when i m using them in my code like this
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplit.CreateStatic(this,1,2))
{
TRACE(_T("failed to create the splitter"));
return FALSE;
}
if (!m_wndSplit.CreateView(0,0,RUNTIME_CLASS(CLeftList),CSize(225, 500),pContext))
{
TRACE(_T("Failed to create view in first pane"));
return FALSE;
}
if (!m_wndSplit.CreateView(0,1,RUNTIME_CLASS(CRightList),CSize(225, 500),pContext))
{
TRACE(_T("failed to create view in second pane"));
return FALSE;
}
return TRUE;
}
in my mainframe class it gives an error...
error C2504: 'CListView' : base class undefined
E:\Documents and Settings\Neha\Desktop\testapp\LeftList.cpp(17) : error C2440: 'return' : cannot convert from 'class CLeftList *' to 'class CObject *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
E:\Documents and Settings\Neha\Desktop\testapp\LeftList.cpp(17) : error C2653: 'CListView' : is not a class or namespace name
and many more
what is the problem??
can anybody help me in this....
Thanks in advance
|
|
|
|
|