|
Hi there,
I have written a little package viewer/builder program to extract files from the file to any directory as well as add new files to the package.
Now it was no big problem to implement drag'n'drop functionality, so that you can add files via dragging file(s) from an Explorer window INTO the program.
However I am having big problems to implement the other way round, so that you can drag a file out of a program into an Explorer window.
Does anyone have some experiences with this and maybe can provide a little example code? If its of any importance, the program itself displays the files in a standard CListView. Oh and I am not interested in d+d operations INSIDE the program, only from Program->Explorer.
Thanks in advance for any response...
|
|
|
|
|
|
I am trying to send a file over a CAsyncSocket and for this i read the file from a CFile into a BYTE or a char. I tried writing the buffer back to a file and this worked for a char as well as a BYTE. But when i tried to send over the connection (the data gets segmented into packets) i needed to stick all the packets together. Now, i didn't know how to do this with a BYTE, so there's my first question, whats the equivalent of strcat() with a BYTE?? Cause i also tried to do this with a char and i used strcat() but it only got to the three first characters or so (might this have anything to do with when u open a binary (i used an .exe) in notepad u get to see empty spaces in some places and that strcat doesn't work with this??)
Again, if someone already knows how to send files over a tcp connection(with or without MFC) please let me know.
thanks
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
|
Hi everyone. I originally was developing a program on a Win95 (osr2) machine, and the code below originally worked fine to write a value to the registry. I think switched to developing on a Win2000 machine, and found something odd. The code below did write to the registry fine, and I verified this with regedit, but after I reboot the machine, whatever I wrote to the registry was gone. I traced through my program many times, and I was not at any point in code erasing what was written. When I first started the program, the registry data was re-written to the registry and was read out successfully when the program was run a second time. But for some reason, whenever I rebooted the machine, the data was gone. I verified this using regedit, and ran this test several times. The reboot caused the data to be erased. This does not happen to any apps I have purchased, so I assume it is my code.
And, is limited to Win2000/NT? It did work on my Win95 development machine, as well as a friend's Win98 machine, as a release build; that is, all data was written to the registry, and was still there after reboot, and was read out succesfully every time.
This code writes to the usual hkey_current_user/software folder in the registry.
The code below writes a string the registry, which is the only data type I am writing to the registry.
<br />
long CRegKey::Write(LPCTSTR pszKey, LPCTSTR pszData)<br />
{<br />
ASSERT(m_hKey);
ASSERT(pszKey);<br />
ASSERT(pszData);<br />
ASSERT(AfxIsValidAddress(pszData, strlen(pszData), FALSE));<br />
<br />
return RegSetValueEx(m_hKey, pszKey, 0L, REG_SZ, (CONST BYTE*) pszData, strlen(pszData)+1);<br />
}<br />
|
|
|
|
|
Sounds like the key is being created with the REG_OPTION_VOLATILE option. Change that to REG_OPTION_NON_VOLATILE.
--Mike--
"Why you keep calling me Jesús? I look Puerto Rican to you?"
-- Samuel L. Jackson in Die Hard 3
My really out-of-date homepage
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
ok, i'm really new to c++
can someone help me ?!
i made a button and i want it to run a file.
how can i do ??
thanks in advance
|
|
|
|
|
Have a look at the ShellExecute function.
Michael
|
|
|
|
|
I made a small editor whose purpose is just to load/save files with a special format. Modifications are made by any graphic editor and Bitmaps datas are exchanged via the clipboard.
The inner format of my application is a DIB (from paintlib).
Recently I decided to add the capability to save pictures with Alpha Channel. But when I paste the datas in Paint Shop Pro it says there's no Alpha Channel in the picture. I'm sure there is and I am working under 32 bits, W98 SP2. I said I am sure there is because I made the same thing with a batch converting fucntion (from file to file) and it does work fine.
I wonder wether it could come from the clipboard or Paint Shop or me . Probably I need to set something particular for Alpha Channel DIBs ?
Below is the copy to clipboard code. Has someone any idea ?
<br />
if (::OpenClipboard(NULL)) {<br />
::EmptyClipboard();<br />
<br />
HANDLE hDIB;<br />
<br />
int MemUsed = GetMemNeeded(GetWidth(), GetHeight(), GetBMI()->biBitCount);<br />
<br />
hDIB = (HANDLE)::GlobalAlloc(GMEM_MOVEABLE|GMEM_DDESHARE, MemUsed);<br />
if (hDIB == NULL)<br />
throw (CTextException (ERR_NO_MEMORY, "Can't allocate global memory block."));<br />
<br />
long* lpCopy = (long *)::GlobalLock((HGLOBAL)hDIB);<br />
memcpy(lpCopy, m_pBMI, MemUsed);<br />
<br />
::GlobalUnlock((HGLOBAL) hDIB);<br />
<br />
::SetClipboardData(CF_DIB, hDIB);<br />
::CloseClipboard();<br />
Yarp
|
|
|
|
|
I don't believe there is any standard regarding alpha channels, apart from 32 bit images allowing for them. paintlib allows you to save the file, have you tried saving and then loading in PSP ? Having said that, most of the functions that appear to support alpha channels in paintlib are not actually working ( i.e. you can't draw with the alpha values in paintlib ). Unless you need W95 support, GDI+ pretty much makes paintlib obsolete.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hi christian, thank you for the reply.
Indeed, I need W95 support my application is distributed from W95 to XP. The reason why I use paintlib classes is that I like the way I can handle DIB (I mean without any Windows handle - I derived my own class form their basic bitmap).
So, yes I tried saving and loading in PSP and I had the Alpha Channel properly compared to the source image (a .PNG). I dug into MSDN and I think that I should use a BitmapV5Header instead of classic a BITMAPINFOHEADER to perform the Copy/Paste (with a CF_DIBV5 format in the clipboard format instead of CF_DIB)... In which case this won't be compatible with W95 but I can deal with that for that purpose. I would like to be sure this is the good way making it. If I can find better I will look at GDI+ thank for the advice.
Yarp
|
|
|
|
|
yarp wrote:
The reason why I use paintlib classes is that I like the way I can handle DIB (I mean without any Windows handle - I derived my own class form their basic bitmap).
paintlib has a DIBSection wrapper, is this what you mean ? There are several good ones about, including one on this site, if that is all you use paintlib for. If you're using a DIB rather than a DIBSection, you may find that using DIBSections solves all your problems.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I mainly use the painlib class as a DIB wrapper not as a DIB section. I have no need of a DIB handle, all blitting is performed through StretchDIBits.
I'll study DIBSection in MSDN it probably can help out. I already have all graphic libraries from that site and others: CXImage, CPicture, CImage, FreeImage, ImageMagick,... but studying all that stuff to find out which is the best only leads to the conclusion that each of them has quality and drawbacks.
I bet that the one which can handle properly a clipboard copy WITH alpha channel will be the one I prefer )
Thank you for your support
Yarp
|
|
|
|
|
I'm thinking that the DIBSection will allow you to use the clipboard by passing in the handle, the beauty of a DIBSection is it combines the best of a DDB and a DIB.
Good luck.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I like the term "the beauty of" this gives me the will to try it on.
Thank you
Yarp
|
|
|
|
|
I have dialog base application with MFC.
I want task manager of win2000 to show my application,in
"processes" ,not in "applications".
Is there anyway for it?
|
|
|
|
|
You should make your dialog toolbox window:
ModifyStyleEx(WS_EX_APPWINDOW, WS_EX_TOOLWINDOW, 0);
Good Luck,
Serge
|
|
|
|
|
I put this line in Oninitdialog() but it show the application in both
"processec" and "application"???
|
|
|
|
|
thats because an application needs a process in order to work.
the application list is just the top level programs from the process list.
// Rock
|
|
|
|
|
dear all,
i am using MSFlexgrid control in my mdi application.
The problem is some times in ".rc" file there are
somuch coding("0x0000") is added autometically at flexgridcontrol defination .
Some times the file(".rc") size is reaching upto 30MB.
Please help me how to avoid this...
thanks.
anju
|
|
|
|
|
Flexgrid is more trouble than it's work - Chris Maunders grid control is heaps better & easier to use.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hello,
I have exactly the same problem and don't know why.
Everything was working well with my flexgrids when I saw my .RC file growing and growing each time I modified the dialog box having this flexgrid, and with it the time to save the ressources files to compile it and so on.
In fact, I think that size (in bytes) given beside the flexgrid control name suddenly becomes false (maybe after a resize of the flexgrid), and then the size doesn't match the initialization data part.
Then, each time you modify the dialog, and so resave its control properties, you degrade a little more the content of .rc file
You can delete some zeroes and make the number of hexa values correspond to the size, but I don't know :
- how is this size calculated (from the 'graphic' design we have done of flexgrid, from the number of columns, number of rows, etc) ?
- there are some non-zero values at the beginning and at the end of data, and between then a certain number of 0x0000, what do they represent, I guess we will find the columns titles, but for the rest ??
- if I delete and recreate the flexgrid, will the size and the initialization data be recreated correctly ?
I would like that Microsoft, not only takes my money, but takes this bug in account and correct it !!!!!!!
This product is expensive enough to receive a correct support from them, He Bill !!!
DD
|
|
|
|
|
I want write method that hook keyboard and return keyboard messages with
'ATL'.I know the solution with MFC,but in ATL what type should my method
return what attribute should it have?
|
|
|
|
|
I will look for this. I have it coded somewhere.
Email me to remind me at lynnphilmcgahan@msn.com;P
|
|
|
|
|
Here is reminder.
Thanks
|
|
|
|
|