|
There is no super shortcut, but you can organize these. This is an example of how I do it:
#ifndef _TEXTSEG<br />
#define _TEXTSEG(name) ".text$" #name<br />
#endif<br />
<br />
#ifndef MY_CORE_SEG<br />
#define MY_CORE_SEG _TEXTSEG(MYS_CORE)<br />
#define MY_GDI_SEG _TEXTSEG(MYS_GDI)<br />
#endif
Then at the top of the source files I add the following as appropriate:
#ifdef MY_GDI_SEG<br />
#pragma code_seg(MY_GDI_SEG)<br />
#endif
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I need to be able to convert a small (say 150px x 30px) 24-bit BMP image to some sort of compressed image - say GIF, JPG or PNG to use on a web page.
I have tried compiling the latest version of GD2 but it leaves a lot to be desired and its probably not quite compatible with VC5. It compiles with oodles of warnings then fails to link. The lib batch file says it works but compiles a microscopic LIB file. I've tried the extern "C" wrappers and stuff but to be honest if the code is this messy then its not what I need for a quick solution. Its far too complex.
I need something fairly simple just to do the basic job - no frills. Perhaps along the line of BMPtoGif(FILE* stream) or BMPtoGif(object*). I'd prefer code which doesn't load from file but could hack it if needed as I already have the BMP in an buffer in memory.
I see there's a definite lack of GIF routines thanks to UniSys - even though the patents have now expired so I expect there ought to be shed loads of BMP2PNG code out there. Hours of Googling have drawn few actual examples of code in the public domain.
Anyone got any pointers to something fairly simple. The app I'm writing is a freeware Win32 CGI console app.
Failing that it means a week or so reading the GD2 code and extracting the relevant parts that work and create my own libarary. I have a feeling its gonna go that way.
|
|
|
|
|
We have routines that do exactly this for our web-based charting module. From memory to memory or disk. Reply to this message so we can start an off-board email and perhaps I can get you the code.
onwards and upwards...
|
|
|
|
|
OK thanks - much appreciated. I was looking for public domain code as I almost certainly won't be selling the application it will be freeware. Its hard enough even giving software away!. I can't even recall anyone even emailing to say "thanks" for any of the stuff I've written!. Good job its an interesting hobby.
I would have thought there would be some GNU Linux-based routines suitable for conversion to Win32.
The code is intended for a small freeware, web-based CGI countdown counter for Apache/Win32 which I have been writing as an excercise in moving away from VB to Visual "C". The counter is working fine but the 24-bit BMP images produced, at 13-15k per image are a bit large - especially if you have several on a page.
Regards
PS Its my first post on this site so I'm not sure if you'd get acess to my email through it. I'd rather not publish it on the net as I already get about 300 spams a day!.
|
|
|
|
|
there are a few articles on Code Project that might be able to help (you'll probably have to convert them back to VC5, though). see the Bitmaps and Palettes section.
or, i know where you can find a nice inexpensive DLL...
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Thanks. I needed to keep the application as a monolithic exe rather than start getting complex about distribution with DLLs. Its only a 60kb freebie and the main gain I am going to get out of it (possibly the only gain) is as one of a first few programming exercises in Win32 CGI. I am tempted to leave it "as is" with fairly large BMP files as output but it seems a bit amateurish not to finish it off and make something useful for people to use by compressing the output files.
I'm fairly happy converting between vb and various flavours of C but some of the code I've seen so far has been incredibly messy and disjointed. Scouring through the GD2 source code is mind-boggling. Although I'd certainly not want to pick fault with anyone who does excellent service to public domain the code bundle is scary to say the least if you're not a graphics programmer! lol
If you wanna have a butcher's its at http://daysto.amadis.sytes.net - a CGI countdown counter for Apache
|
|
|
|
|
you might also check out ImageMagick. it does a lot of formats, and picking out the code you need is, not exactly easy, but definitely do-able.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Hey, thanks. That looks quite promising.
I'm baffled that in the years of VC++ GIFs and BMPs that someone hasn't put together something quick fairly simple like an idiot-proof function lib. Searching Google its like PNGs and BMPs were only invented 12 months ago!. Top marks to the GD2 guys but its a bit too hardcore for me to compress one image. I'm pretty sure I'll have to strip the guts out of some other code and rewrite a small library.
|
|
|
|
|
Hi,
I want to process LZ compression on some buffer of memory.
As far as I know LZExpand package enables to read only the zipped files.
Can anybody give me a hint?
Thanks
DavidR
|
|
|
|
|
Get and use the zlib library.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
|
When I read about the bug last week, dummy me thought they'd already fixed it. However, for controlled data, I don't think it's a problem.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
I have a problem
I finished programming my c++ software
When I run the software, it is working normaly but when I exit the dialog using DestroyWindow() an error message appears saying: "Debug Assertion Failed!" winhand.cpp and line 229
Then, the software exit like it is suppose too but how can i get rid of this message
help plz it is very bothering
and i couldn't enter my name and e-mail to send this message for a reason although i am halawlaws and my e-mail is ahalwany@hotmail.com
thx
Halawlaws
|
|
|
|
|
Halawlaws wrote:
...but when I exit the dialog using DestroyWindow()...
Why are you doing this? Is this a modal dialog?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Try exiting the dialog using EndDialog(). Also, sometimes it is helpful to look at the code the error message is pointing you to, in this case winhand.cpp/line 229. And by the way,
Halawlaws wrote:
Then, the software exit like it is suppose too
The software is not exiting like it is supposed to. The software is aborting becuase of a debug assertion failure. If, for example, when exiting this dialog you were supposed to return to another part of the program, your software would still completely exit.
I can't tell anything more without actually seeing some of your code. Hope this helps!
Danny
|
|
|
|
|
Hey Dany thx man EndDialog(0) worked my program is now perfect but i still didn't know why this assertion problem occured
regards
Halawlaws
|
|
|
|
|
Hi there,
I have in my application a window in which I open files for edit. I present them in a tab style when there is more than one window open (similar to the source browser window in Visual Studio). what I'm trying to do is changing the name of the tab for views which are of the same document. Unfortunatly, I have no success till now.
First I try SetTitle() but ofcaurse that causes to all of the tab titles related to the same document to be changed.
Then I tried to do the following steps:
I add in
1. CChildFrame::PreCreateWindow(CREATESTRUCT &cs) :
cs.style&=~(LONG)FWS_ADDTOTITLE;
2. CMyView::OnInitialUpdate() :
GetParent()->SetWindowText("temp");
but it made no effect on the title.
How can I change the title of those tabs ? From where those tabs take the data for the title ?
I really need your help here,
thanks,
yaron.
|
|
|
|
|
Try overriding OnUpdateFrameTitle (undocumented) in your CChildFrame . Look at the standard implementation of CMDIChildWnd::OnUpdateFrameTitle in MFC source files to get a hint on how to implement it.
Hope that helps,
--
jlr
http://jlamas.blogspot.com/[^]
|
|
|
|
|
Hello,
I have a CString variable with a date and i want to extract the day.
My problem is that i don't know the regional settings of the machine (for example if date is yyyy-mm-dd or dd-mm-yyyy) so i can't use for example .left(2)
I want to know if i can access to the regional setting format date in C++ or how to convert a CString into a date.
Thanks
|
|
|
|
|
Using the win32 api, you could do something like this snippet here:
char caData[256];
caData[0] = 0;
GetLocaleInfo(LOCALE_SYSTEM_DEFAULT,LOCALE_SSHORTDATE,caData,sizeof(caData)-1);
m_cShortDateFormat = CString(caData);
char *p = caData;
while (*p && *p == ' ')
p++;
switch (*p)
{
case 'd':
m_cClientFormValidationDateFormat = "D/M/Y";
break;
case 'Y':
m_cClientFormValidationDateFormat = "Y/M/D";
break;
case 'M':
default:
m_cClientFormValidationDateFormat = "M/D/Y";
break;
}
onwards and upwards...
|
|
|
|
|
Something like:
CString strDate;
COleDateTime date;
date.ParseDateTime(strDate, VAR_DATEVALUEONLY);
TRACE("Day = %d\n", date.GetDay());
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
I'm using ClistCtrl to display some data I'm receiving.
I need to display only the updated data,so the old data will disappear when there is new data to display(i get new data every 200msec).
The problem is that my ListCtrl is flickering when I'm calling
MyList.DeleteAllItems() function(I'm doing it with timer event).
How can I avoid this annoying flickering?
With best regards,
Eli
|
|
|
|
|
Instead of using DeleteAllItems(), use CustomDraw message handler and in that one include to DeleteAllItems() and insert the new data.
Neelesh K J Jain.
|
|
|
|
|
Hi Neelesh,
Thanks for your prompt reply.
Do you have any example how to do this?
How should I use the CustomDraw message handler?
Regards,
Eli
|
|
|
|
|
Eli,
you can see the article "Dynamically Highlight Elements in a List Control" at http://www.codeproject.com/listctrl/highlightlistctrl.asp
Neelesh K J Jain
|
|
|
|