|
It's the icon at the top-left that by default is MFC. The resource file for the icon is res\main.bmp
It is a 26x26 32-bit bitmap. For the icon I have a png file that has transparency. My problem is how to change the icon while preserving the transparency of my original png. Since by default the bitmap is 32-bit I assume it supports transparency, but when I saved my icon as 32-bit bitmap from photoshop, the new icon simply wasn't displayed. If I save it as a 24-bit bitmap it is shown but there's no transparency of course, which is a big problem.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
sashoalm wrote: the new icon simply wasn't displayed - how do you mean that? It crashed? It was there but was fully transparent? Are you sure your 32 bit BMP had anything on its alpha channel?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
No, no, it didn't crash. I meant that visually it wasn't there. There seemed to be something that was a bit whiter where the icon should have been, but overall the "jewel" was an empty circle with no icon inside it.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Check the alpha channel of your BMP, maybe it's empty...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
My problem is solved now after some googling, thanks to this free tool[^] by Adam Najmanowicz which converts png files to 32-bit bitmaps while preserving transparency. It works great now
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I have a C++ native Win32/MFC app which uses a structured exception handler. When the handler is invoked, I'd like to be able to create a crash dump file to allow the user to submit it for analysis.
I'd like to, from within code, create the dump file and I need to do it under both WinXP and Win7.
Then if a user is experiencing a crash, they can enable this as an option and then send us the crash dump file which gets written.
Any ideas?
|
|
|
|
|
How about this[^]?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
awesome! Thank you for the link. I'm going to give that a try.
|
|
|
|
|
Is it possible to get the WinInet interface reference of a browser, IE or firefox
Regards
Rajmohan
|
|
|
|
|
Not sure what you mean by WinInet interface for IE.
But you can check out BHOs and some interface you can get from IE like IWebBrowser2 , IHTMLDocument2 , IHTMLElement etc.
|
|
|
|
|
Thank you so much for your response. Actually I was able to get the IWebrowser2 and IHTMLDocument2 for internet explorer. My aim was to get these type of helper objects to assist Firefox, Since firefox is using WinInet dll ( I was able to find with some tool) I queried about WinInet.
Regards
Rajmohan
|
|
|
|
|
How to load PNG image on the dialog using the Resource ID of the PNG imqage.
|
|
|
|
|
Use GDI+ or CxImage
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
If you are using the MFC Feature Pack you can use the CPngImage class. You can simply Load PNG image from the resource and use it as CBitmap because CPngImage inherits it. Other way is to use the CImage class which is part of ATL but it can load PNG only from file. As far as I remember CImage::LoadFromResource can load only bitmaps. IMHO CPngImage is more convenient when you just need HBITMAP of the PNG and CImage is more convenient when you are going to blit it on some HDC. But if you need to load from resource CPngImage is your class.
|
|
|
|
|
Hi All,
I want to change the color depth of JPEG image.How can I do that?
|
|
|
|
|
As far as i know JPGs ALWAYS have 24 bits per pixel, "by definition".
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
I want to change color depth like 8 bit instead of 24
|
|
|
|
|
Check out CxImage[^], it might have what you need.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
I dont want to use such huge library. I am spacific for only one file type (jpeg). Can you suggest me some simple and lesser size code?
|
|
|
|
|
Hmm, maybe GDI+[^], it comes with Windows. If you don't like that either then depending on your needs i would google for some 3rd party library like jpeglib.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Computers are evil, EVIL i tell you!! <
|
|
|
|
|
Hi all,
I am working on transcoding using ffmeg.Im having the mpeg4 video and alaw audio which should be converted to the desired video and audio format.Im reading the frame by frame conversion from my media stream using av_read_frame(...)
int main(int argc, char **argv)
{
const char *filename;
AVOutputFormat *fmt;
AVFormatContext *oc;
AVFormatContext *ic;
AVCodecContext *pCodecCtx;
AVCodec *pCodec;
AVStream *audio_st, *video_st;
int i,frame,video_stream;
av_register_all();
filename = "test.mp4";
if(av_open_input_file(&ic, filename, NULL, 0, NULL)!=0)
return -1;
if(av_find_stream_info(ic)<0)
return -1;
video_stream=-1;
for(i=0; i<10; i++)
if(ic->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO)
{
video_stream=i;
break;
}
if(video_stream==-1)
return -1;
pCodecCtx=ic->streams[video_stream]->codec;
pCodec=avcodec_find_decoder(pCodecCtx->codec_id);
if(pCodec==NULL) return -1;
if(avcodec_open(pCodecCtx, pCodec)<0) return -1;
AVPacket pkt;
AVFrame videoFrame;
fmt = guess_format(NULL, filename, NULL);
if (!fmt) {
printf("Could not deduce output format from file extension: using MPEG.\n");
fmt = guess_format("mpeg", NULL, NULL);
}
if (!fmt) {
fprintf(stderr, "Could not find suitable output format\n");
exit(1);
}
oc = av_alloc_format_context();
if (!oc) {
fprintf(stderr, "Memory error\n");
exit(1);
}
oc->oformat = fmt;
_snprintf(oc->filename, sizeof(oc->filename), "%s", filename);
AVStream* stream = av_new_stream(oc, 0);
AVCodecContext* videoEncoderContext = stream->codec;
setupVideoEncode(videoEncoderContext);
stream->sample_aspect_ratio = av_d2q(1, 255);
stream->pts_wrap_bits = 33;
stream->codec->thread_count = 0;
if (av_set_parameters(oc, 0) < 0) {
return 0;
}
AVCodec* codec = avcodec_find_encoder(videoEncoderContext->codec_id);
if (!codec)
{
return 0;
}
if (avcodec_open(videoEncoderContext, codec) < 0)
{
return 0;
}
av_write_header(oc);
const char *ofilename = "testresult.mp4";
if (!(fmt->flags & AVFMT_NOFILE)) {
if (url_fopen(&oc->pb, ofilename, URL_WRONLY) < 0) {
fprintf(stderr, "Could not open '%s'\n", filename);
exit(1);
}
}
int audioFrameFinished = 0;
int videoFrameFinished = 0;
const int outbuf_size = 640000;
uint8_t outbuf[outbuf_size];
int64_t lastpts = 0;
while(av_read_frame( ic, &pkt ) == 0)
{
if (video_stream == pkt.stream_index)
{
avcodec_get_frame_defaults(&videoFrame);
avcodec_decode_video(pCodecCtx, &videoFrame,&videoFrameFinished,pkt.data, pkt.size);
videoFrame.pts = pkt.dts;
if (videoFrameFinished)
{
int out_size = avcodec_encode_video(videoEncoderContext,outbuf, outbuf_size, &videoFrame); if (out_size > 0)
{
AVPacket outpkt;
av_init_packet(&outpkt);
outpkt.data = outbuf;
outpkt.size = out_size;
outpkt.stream_index = 0;
outpkt.dts = outpkt.pts = videoEncoderContext->coded_frame->pts;
outpkt.flags |=(videoEncoderContext->coded_frame->key_frame) ? PKT_FLAG_KEY : 0;
if (av_write_frame (oc, &outpkt) < 0)
{
return 0;
}
}
}
}
av_free_packet( &pkt );
}
av_write_trailer(oc);
avcodec_close(videoEncoderContext);
av_free(videoEncoderContext);
for(i = 0; i < oc->nb_streams; i++) {
av_freep(&oc->streams[i]);
}
if (!(fmt->flags & AVFMT_NOFILE)) {
url_fclose(oc->pb);
}
av_free(oc);
return 0;
} )
In the above code,the bold statements failed always..(avcodec_open() after avcodec_find_encoder() and avcodec_encode_video(...))
Do any one help me?
Thanx..
|
|
|
|
|
Try calling
avcodec_init();
avcodec_register_all();
near av_register_all();
|
|
|
|
|
hi
I have solved that by assigning correct parameters...(In setupVideoEncode(videoEncoderContext)).
But now im getting crash in av_write_frame(..)inside that loop.
pls help me..
|
|
|
|
|
Hi all,
i m working on Rapi function,so i m using Rapi and Ceutil dll,
but here CFileDialog display strange behaviour,
when i open CFileDialog its crash when Mobile device center not installed,or Rapi.dll and Ceutil.dll place in application exe folder.
please help me how can i resolve this.
thanks in advance.
|
|
|
|
|
To rule out MFC, try using GetOpenFileName() or GetSaveFileName() instead.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|