|
Hey!
I developed an ActiveX control, using ATL, and then packed it inside a CAB file, and signed the file.
Then I created an HTML with the proper <object> tag and everything, and tried it out. Worked great on my Win2k. Also works great on Win98/ME.
Doesn't work on Win95 (IE5) or WinNT4 (IE5.5).
The problem on both platforms seems to be the same - the CAB is downloaded, the "Do you trust..." dialog box appears. I click YES. Then the icon on the top left corner of the rectangle where the control should appear, changes to reflect the fact that the component can't be downloaded.
Since components are downloaded to C:\WINDOWS\Downloaded Programs - I checked this directory - and couldn't find the DLL there!
Perhaps this is the time to mention that my DLL in the CAB has a DLL extension, not OCX (does it / should it matter?)
I also didn't write an INF file. The DLL is the only file contained in the CAB.
Any suggestions?
Thanks,
Oz
|
|
|
|
|
i have got one problem.. i am sending an html - email with some user-defined variables..
first i have used a temporary file, which was really great, cause i could use the very convient << to add data to the file...
now i tried to use cstrings (if it just works with std_strings it is no problem though) and i'm really sick of the '+='.. cause i jsut can add one thingy add a time.. otherwise it says that it can't add pointers...
anyone knows something like << for strings (if i have to use stl - strings.. no problem though)..
i just don't wanna use a file.. and i'm sick of the '+='
thanks in advance
bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
anyone knows something like << for strings (if i have to use stl - strings.. no problem though)..
Sure, check ostringstream out. Welcome to iostream C++ library.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi,
My Visual Studio is crashing when I right click on any control in a resource dialog.
I get this error.
The instuctions at "0x519f112c" referenced memory at "0x00000004". The memory could not be "read"
I am using VC++ 6.0 on Windows 2000 with WndTabs and Visual Assist.
Any ideas why this is happening?
thanks
Kant
|
|
|
|
|
Sorry about that,
I'm trying to figure out how to format a c string or a standard string.
How do I make it bold, change the colour and size of it etc?
Cheers
Jon
|
|
|
|
|
a cstring or a std_string are just reprasentatives of a string.. it's in the program.. i think your questions is: i have got an edit box.. how do i underline... it in the box ...
is this your question or am i wrong???
bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
|
if you want the user to do this in an edit - control use the RichEditControl.. it is pretty the same control used in the WordPad (you can do all that stuff)
If you would like to do this for one EditControl in your Dialog then you can use the SetFont MemberFun of the Control..
hope this helps
bernhard
"Politicians and diapers have one thing in common. They should both be changed regularly and for the same reason."
|
|
|
|
|
Hi all!! I'm learning C++ and there I'd like somebody to tell me how to properly use the class CString. The problem is that I've a lot of problems with it, when I'm using different CString vars sometimes they screw each others' values. I've noticed that using a property called GetBuffer and ReleaseBuffer, they get fixed.
Could somebody tell me the use of that properties and which is the difference between using MyCStringVar.GetBuffer(iBufferLength) and (LPTSTR)(LPCTSTR)MyCStringVar ?? As far as I know they both return a pointer to the string.
I know it might be a basic question but if somebody could answer it I'd really appreciate it, thanks.
|
|
|
|
|
If you don't need to modify the strings contents then use the (LPTSTR)(LPCTSTR) cast. If you want direct access to the CString buffer (so you can modify it) then use GetBuffer.
|
|
|
|
|
The problem I had is that If I used this code:
CString MyString;
mFile->Read((LPTSTR)(LPCTSTR)MyString, iMyLength);
MyString.Replace("something", AnotherStringWhichIsAMemberVarOfTheClass);
When reading the file, the var AnotherStringWhichIsAMemberVarOfTheClass got screwed it's value with what I wanted to read (from the file).
Then, by using the Try-All-The-Methods-Of-The-Class solution I noticed that If I wrote:
CString MyString;
mFile->Read(MyString.GetBuffer(iMyLength), iMyLength);
MyString.ReleaseBuffer();
MyString.Replace("something", AnotherStringWhichIsAMemberVarOfTheClass);
Everything went right, but I still don't understand why. I'm modifying MyString's content and you've told me that then it'd be better to use GetBuffer(), but contents of AnotherString(...) get screwed when reading the file and before modifying it.
Could you tell me why ????
Thanks for everything.
|
|
|
|
|
OK, it's very simple: CString internally holds a buffer of characters. From our standpoint (programmers using the CString class who don't know exactly how it works) CString's buffer grows/shrinks based on its contents.
In the first scenario (the one that breaks) you instanciate a CString object (MyString) using its default constructor. This means that it's empty -- it's got an empty buffer. Then you read the file and try to copy its characters into the empty CString object. Since it's got an empty buffer, you end up inadvertently copying the characters to whatever memory is adjacent to it. So you basically overwrite memory which you hadn't allocated for that purpose. This is very bad, as you noticed.
In the second scenario, you call GetBuffer to not only return a writable buffer (LPTSTR), but you also tell the object to allocate iMyLength bytes for you to copy into. After reading from the file, you tell the CString object that you're done using the buffer (ReleaseBuffer) and that it should clean it up (find the terminating null character) and make the object ready for use.
I hope this is clear to you, but let me just say that usually if you have to do nasty casting like (LPTSTR)(LPCTSTR)MyString, it's a sign that something's not quite right. You should never do that with a CString object unless you're certain that its buffer won't be changed (ie., you're passing a CString object to poorly written code that should have used LPCTSTR instead of LPTSTR).
The general rule is: if the function takes an LPCTSTR (or const char*), use the object directly (no casting needed). If the function takes an LPTSTR (or char*), use GetBuffer/ReleaseBuffer.
Regards,
Alvaro
|
|
|
|
|
Hello, the codegurus around the world.;)
One rule is that you had better use MFC as much as possilbe in your code
if you want to use CString.
If you want to read the content of the file, you can use CStdio calss.
Since you use CString value, and want to pass const char* (LPCSTR) of the function,
it sometimes waste your code line (GetBuffer...) or the memory. (but, maybe not big deal).
However, if we use COM or Unicode, we face this kind of problem so often.
The string conversion gives us so much headache.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
(edited)
Alvaro's explanation points to the reason. But note that even the following won't work:
CString a = "Ophelia";
CString b = a; // *1*
strcpy((LPTSTR)(LPCTSTR) b, "Hamlet"); // *2*
will change a and b, because:
CString uses a "copy on write" mechanism. At line *1*, b will reference the same string buffer as a. Only when you change one of the strings, an actual copy is made.
*2* now modifies the shared string buffer without CString having any chance of knowing it. Hence no copy, hence a shared buffer gets modified.
-----------------------
CString doesn't have a cast to LPTSTR for a reason. And blindly casting to LPTSTR is definitely not a good idea.
Peter
|
|
|
|
|
thank you all!, nice explanation and I've understood it!
|
|
|
|
|
Read this :
http://www.codeproject.com/string/cstringmgmt.asp
----
Xian
|
|
|
|
|
Does anyone know if I can talk to the parallel port the same way I'd do so with the serial port ( eg CreateFile(...,"COM1",...) -> CreateFile(...,"LPT1",...) ).
It'd be easy to test it out, but I don't have the hardware that I want to talk to - and I won't buy it unless I know I can talk to it over the parallel port under Win2k.
If anyone's interested, I'm trying to figure out whether or not I could build a Win2k driver for this Seiko 320x240 monochrome LCD screen (for an oboard computer in my car).
--
Russell Morris
Georgia Institute of Technology
"Hello, I'm doctor stupid. I'm going to take out your liver bones!" - Ralph Wiggum
|
|
|
|
|
Check this out:
http://www.naughter.com/parallelport.html
I've used his serial port wrapper class with great success.
Mike Mullikin
"Real programmers don't document their code. It was hard to write - it should be hard to read!"
|
|
|
|
|
Friggin' perfect!
I'm somewhat disappointed, though, as now I'll have to spend $200 on this LCD screen so I can start playing with it!
Thanks.
--
Russell Morris
Georgia Institute of Technology
"Hello, I'm doctor stupid. I'm going to take out your liver bones!" - Ralph Wiggum
|
|
|
|
|
look at this
http://www.techsoft.no/bendik/
or this
http://www.codeguru.com/treeview/CMultiTree.shtml
|
|
|
|
|
Hi,
I would like to have an OnKeyDown event like, for the virtual keys ( -> <- ALT CTRL), is there anyway to do that, or I have to go to the PretranslateMessage... ?
Thanks, Bye!
Braulio
|
|
|
|
|
Hi,
I need to find a tool or learn some techniques that can help me trace GDI leakage. I've found some tools on MSDN which work for Windows Me and 2000, but i also need to check on NT4. Besides, the tools i found on MSDN weren't very good anyway. They reported massively spiralling leakages for palletes and regions and bitmaps when i'm not creating any! Surely to leak, i would have to create and forget to destroy. So those tools may justfifably have been telling me about leaks - but definately they were incorrectly identifying the resource. And they didn't help you find the code.
Any ideas please ?
Jase
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
View your digital photos and images with ease using the ultimate desktop image manager for Microsoft Windows
Download your free copy of SlideShow Desktop today from http://www.slideshowdesktop.com
|
|
|
|
|
Hi Jase !
There is a tool called GDIObj.exe ( Try to find this on the web), if you don´t have it tell me, and I send it to you.
HTH
Braulio
|
|
|
|
|
Hi Braulio,
Thanks for you reply. I searched using google.com and found a gdiobj.exe on ftp.microsoft. It turned out to be a self extracting zip file from 1995 containing source code which i couldn't build (it doesn't have a workspace, so i would have to work out the libraries and dependencies myself in order to link it). It also came with 2 exe's which were dependant upon mfc30.dll so i coldn' run them.
I would really appreciate it if you could send me your copy.
jpj@totalise.co.uk
Thanks
Jase
-------------------------------------------------------------------------------------------------------------------------------------------------------------------
View your digital photos and images with ease using the ultimate desktop image manager for Microsoft Windows
Download your free copy of SlideShow Desktop today from http://www.slideshowdesktop.com
|
|
|
|
|
Bounds checker is probably the best tool for tracking GDI leaks, but it ain't cheap. For memory leaks I would recommend PurifyNT, but, again, it's expensive.
In my experience of Windows programming (10 years now) the most common leaks are:
* Deleting pens, brushes or fonts that are still selected in the DC.
* Calling GetDC without a corresponding ReleaseDC.
Regards.
|
|
|
|