|
There are lots of reasons to have a global variable without being "seriously flawed". See my other reply.
|
|
|
|
|
Which is why I said it "could" be flawed, instead of it is flawed. And asked him to check the design.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Well, this poor guy asks about global variables and he gets no helpful replies, just people asking "why" he wants to do it or questioning the "design". I can't figure out why nobody would just answer the simple question.
|
|
|
|
|
It's not that I don't want to answer how to use a shared variable. Do you think the answer is difficult?
I suspect that he's trying to do something that can be done in other fairly better. I wanted him to do things the right way. He hasn't answered my question, so I don't know what he's trying to achieve.
People can co-operate a little when someone is willing to expend their time, you know?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Rajesh R Subramanian wrote: It's not that I don't want to answer how to use a shared variable. Do you think the answer is difficult?
Don't be insulting, of course I know it's simple. I said it was a simple question in the reply you are responding to plus I already posted the answer.
Rajesh R Subramanian wrote: I suspect that he's trying to do something that can be done in other fairly better. I wanted him to do things the right way.
Your definition of the right way. His definition of the right way was to use a global / shared variable.
Rajesh R Subramanian wrote: He hasn't answered my question, so I don't know what he's trying to achieve.
So until he passes some sort of design review conducted by you, you refuse to answer his question. That's an OK answer for somebody asking about designing a database or entire application but for goodness sake, he only wanted to know how to go about declaring and using a global variable, hardly inquisition material.
|
|
|
|
|
Chuck O'Toole wrote: Don't be insulting,
I fail to see how was my post insulting.
Chuck O'Toole wrote: Your definition of the right way. His definition of the right way was to use a global / shared variable.
Bleeding obvious, we all go by what we've learned from our individual experiences, so my right way may be different from his right way. However, there are some practices that are usually considered harmful. I only wanted to know what he's trying to achieve. Are you telling that I cannot ask someone what they're trying to do, when I feel that there is a better way than what they're doing it in?
I'll ask such questions. I've been doing it for years, that's how I do it, even if someone didn't like it.
Chuck O'Toole wrote: So until he passes some sort of design review conducted by you, you refuse to answer his question.
Excuse me? It isn't a "design review" (do you call this a design review?). Are you just hyping things up for arguments sake? I just wanted to know what he's trying to do. It isn't a global variable, he wanted a variable that he could manipulate from multiple source files, which can usually be avoided. And yes, there are exceptions.
I have already been expending more time than what I'll be willing to do on this argument of this sort. This is serving nobody. So, this is it for me.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
In a common header file (I put mine in StdAfx.h), declare the class and the fact that the pointer (global variable) is external.
class Logger;
extern Logger *TheLogFile;
In the "declaring" module (and any module that uses the global variable), include the class definition
#include "Logger.h"
In the declaring module, declare and initialize the global variable.
Logger *TheLogFile;
...
TheLogFile = new Logger();
TheLogFile->SetFolder("Log\\");
TheLogFile->SetPrefix("UpdateProcess");
|
|
|
|
|
Hi to All,
I am sorry if I have posted in wrong forum.
I am trying to learn to make a splashscreen on my MFC application.
I downloaded one sample example,in which there is one .bmp file...If I open it I can see red background. But If I run the demo application, it shows transparency (ie the bacjground is transparent, only the main pictures shows off)...
Now, could anyone please tell me how to create a similar picture like that with .bmp extension...
thanks in advance
-----------------------------
i am on the way to MFC land
|
|
|
|
|
Transparent BMPs are created using not one but two BMPs.
One is the actual bitmap and the other is a mask.
These two bitmaps are then ANDed and XORed with the background to get the transparent affect.
Look into the following articles on how it is done.
Creating a Transparent Bitmap[^]
Windows GDI Tutorial 1 - Drawing a bitmap[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Your question is not clear but if you can point us to the sample application, then we may be able to explain its behavior
Or
If you want to make a splash screen, just create a new thread and in that thread Create a new window. This thread creation goes at beginning of InitInstance and after your application is initialized, you can kill that splash window thread (at end of InitInstance maybe).
|
|
|
|
|
|
isn't a bmp with transparent background called png image? in the link posted by you, the sample bmp image is treating the pink color as transparent. And also the code is using gdi and not gdiplus. I would suggest you to find some sample code that uses gdiplus for drawing. gdi is outdated and the sample code is not showing the splash screen in separate thread. such a splash screen will only be shown when the initialization is already done.
Of what use is such a splash screen?
also, if your purpose is to create a splash screen, then the link is of not much use to you. If your purpose is to learn window creation, drawing, setting regions etc then you should find another article.
check this for transparent bitmap concept
for setWindowRgn demo, MFC Transparent CDialog Demo
for gdiplus Starting with GDI+[^]
&
Loading JPG & PNG resources using GDI+[^]
|
|
|
|
|
thanks a lot for your suggestion. I will do so...
-----------------------------
I am a beginner
|
|
|
|
|
See TransparentBlt[^] function, and look for the remarks for the last parameter:
....
crTransparent [in]
The RGB color in the source bitmap to treat as transparent.
....
hrishiS wrote: Now, could anyone please tell me how to create a similar picture like that with .bmp extension...
You create pictures with MS Paint or Adobe Photoshop
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi
How to Export Images into PDF using VC++?
is there any possible solution
Thanks !!
|
|
|
|
|
There are multiple possibilities for that:
1. Learn the PDF format and write your own code
2. Use a PDF Printer driver like CutePDF[^] and print your images
3. Get a hold on a PDF writer library like PDF Creator Pilot and use it
There might be more but these 3 come to my mind right now...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Check this article right here on CP - The Great PDF - Revealed[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
LibHaru[^] comes to my mind.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
hi
i use one edit Control in my Dialog.
when i use below code for read content of it :
[code]
GetWindowTextA(hEdit,editStr,10);
[/code]
if content of Edit control is more than one Character my program give error in :
[code]
EndDialog( hDlg, FALSE );
[/code]
error:
First-chance exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.
Unhandled exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.
if i enter one Character in Edit control error dont accure.
why ?
|
|
|
|
|
1. Are you completely sure that GetWindowTextA causes the problem?
2. How did you declare editStr ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
editStr is LPSTR and i debug it. my program get string correctly and store it on editStr but only cant do EndDialog() if string be more than one Character!
|
|
|
|
|
Please post the code extract (and remember to format it properly in <pre></pre> tags) that contains the definition and initialisation of editStr . Also what else can you see through the debugger at the EndDialog() call.
|
|
|
|
|
And what does it point at? You will have to feed GetWindowTextA with a pointer at a buffer that can hold the characters, if you do something like this:
LPSTR editString;
GetWindowTextA(hedit, editString, 10);
GetWindowText will copy the characters somewhere in memory and who knows what it overwrites -> problems. Or it crashes vith Access Violation (better case since then you know what is wrong, however if it does not crash immediately just overwrites something in the memory area of your process then it can die on anthing anywhere later and you might have no idea why...)
You could either try this:
char editString[11];
GetWindowTextA(hedit, editString, 10);
or maybe something like this:
LPSTR editString;
int len = GetWindowTextLength(hedit);
editString = new char[len + 1];
GetWindowTextA(hedit, editString, len);
...
delete []editString;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
The Error is completly correct, you need a buffer or string to store the text, not only a pointer
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi All
i am reading excel row and column.I read successfully but i got error when excel cell values like this "12:10:59" i mean time format.I am reading like this
[code]
_variant_t vItem = pRange->Item[ iRow ][ iCol ];
_bstr_t bstrText( vItem );
[/code]
Plz help me
modified on Wednesday, September 30, 2009 3:01 AM
|
|
|
|