|
Three things:
- Your maximum function sorts the array passed in, totally destroying your data.
- You initialize your table array to all zero, and never add anything to it. What's the use of that?
- in your histogram function, you have if (frequency [j+2] <= max) . This line will *always* be true.
Your basic logic here is flawed. You initialize the frequency array just fine, but you are messing up your data and display code.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Not really sure where this should go but I thought I'd ask here first. Does anyone know how I can make an installer for my IE Deskband (Toolbar)?? All I have to do is compile the code and it automatically works on my computer but how do I make it install onto another person's computer? Thanks for any help.
|
|
|
|
|
regsvr32 [dll name]
many installation tools have an option to autoamtically register ( call DllRegisterServer ) of dlls included in the install package.
to remove the toolbar you need to call DllUnregisterServer. for example by using regsvr32 again with the /u parameter.
|
|
|
|
|
Visual Studio Installer is a good free setup creator program. It builds Windows Installer files (*.msi) and automates some of the more complex parts.
It is available from Microsoft at:
http://msdn.microsoft.com/vstudio/downloads/tools/vsi11/default.asp
Do unto others as you would have them do unto you - Jesus
An eye for an eye only makes the whole world blind - Mahatma Gandhi
|
|
|
|
|
hi programming freaks,
i make a win32 header and related cpp classes and make a dll .Ok.
now when i want to use the dll in other application i include headers and i think everything is ok ,but visual stadio.net throw me a LNK2019 fatal error.
i don't know what's wrong .
thank u in advance .
please give me a clue!
|
|
|
|
|
rzitman@yahoo.com wrote:
i don't know what's wrong .
Are you working under a managed environment with VS.NET? If so you need to use P/Invoke.
-Nick Parker
|
|
|
|
|
no ,look i use win32 projects .
u know my problem is that my newly made dll isn't loaded in my program properly .
compiler throw me some fatal errors like i can't find the dll .
in a nutshel:
my DLL makeing project :
neededheader.h
relativecpp.cpp
madeDLL.dll
now my test project:
neededheader.h
madeDLL.dll
testcpp.cpp
-----------------
Nick could u shed me a light in this issue?
|
|
|
|
|
When you build a DLL you also get an import LIB file that contains the functions and data exported from the DLL. The other app needs to link with that LIB so it knows which DLL contains the functions/data.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Hi:
I'm working on custom editbox activex control but i have two problems!
1)
i have read a lot of articles in MSDN about changing the BackColor
and TextColor of an edit box through the "WM_CTLCOLOR" message
"""OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)""".But i couldn't use them
in my project to change the BackColor and TextColor of editbox.in the other hand
the mentioned function doesn't work in Activex projects!!!.i have tested frequently.
2)
in some conditions i need to have an editbox with Right-To-Left
reading order so i useed following code to do this:
void CMyEditBoxCtrl::PreSubclassWindow()
{
// TODO: Add your specialized code here and/or call the base class
COleControl::PreSubclassWindow();
ModifyStyle(0,ES_RIGHT);
}
But as you know this is in design mode and....how can i swith between two styles(ES_RIGHT and ES_LEFT) at RUN-TIME ???
this is very important for me.
a beginner in activex programming.
Regards.
|
|
|
|
|
Is there a way to find out which ports are open on the local machine and is there a way of opening and closing ports?
|
|
|
|
|
Hi,
What i am trying to do is to create my own color palette with values that i set...for example:
Red will be 00000001
Blue will be 00000011
and so on....
so at the end i can have a BMP or JPG picture created by a binary data that i created...
Is that possible ? anyone knows ?
thank you for your time
-mario
|
|
|
|
|
im looking for an easy way of changing the background of the dialog window to
some tiled bmp image and also replacing the standard button with a bmp
please help me .
|
|
|
|
|
|
I dont want to use any derived classes.
|
|
|
|
|
Take a look on http://www.codeproject.com/cpp/cppforumfaq.asp#ui_bkcolor
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
Hi.
I using VC++ v.6 and i want to make a program that loads some data from a file and then creates a black and white picture of the data.
Example:
I have a file ("logo.dat") that all it has inside is a logo created by 0's and 1's in a list form that looks like this:
0111110001000100011111000100010001000100 , which actually is :
01111100
01000100
01111100
01000100
01000100
that makes letter A.
Now what i want to do is make the program to load that file and make a B&W BMP or JPG of some dimension that every pixel of the picture represents a 0 or 1 from the file.
It kinda like that programs that takes a picture and makes it in ASCII format in a txt file.
I want to do something like that.
And also reverse the process....like make a JPG or BMP on MSpaint by hand and then the program will make it into 0's and 1's.
I hope i gave a good description of the problem....
Does anyone has any ideas how can this be possible? or where i can get some information about it?
Thank you very much for your time
-mario
|
|
|
|
|
Hi Mario,
perhaps you could use an old function I've written when I've started lerning c
(so the implementation is a little bit more complicated, than it should be)
you only have to create an array which contains your data.
for example:
int x_dim,y_dim
unsigned char* raw;
x_dim=4711; //here insert your width in x-direktion
y_dim=4711; //here insert your width in y-direktion
raw = new unsigned char[x_dim*y_dim];
for(int j=0;j<ydim;j++){
for(int="" i="0;i<xdim;i++){
" raw[i+j*xdim]="//here" you="" must="" decide="" which="" color="" your="" 0="" and="" 1="" should="" have,="" for="" example="" is="" white-="">255, 0is black->0
}
}
then call: raw2bmp(raw,"test.bmp",x_dim,y_dim); and your bitmap should be ready
Hope I could help you
void raw2bmp(unsigned char* raw_data,char* bmp_filename, int xdim, int ydim){
FILE *fp;
int i,j;
fp=fopen(bmp_filename,"wb");
i=xdim*ydim + 4*256 + 54; //Dateilaenge ermitteln
//Datei-Header schreiben
fputc(66,fp);fputc(77,fp); //Magic Number
j=i%256; fputc(j,fp); //Dateilaenge
j=(i%(256*256))/256; fputc(j,fp);
j=(i%(256*256*256))/(256*256); fputc(j,fp);
j=i/(256*256*256); fputc(j,fp);
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp);//4 reservierte Byts
fputc(54,fp);fputc(4,fp);fputc(0,fp);fputc(0,fp);//Zeiger auf Datenanfang
//Format-Header schreiben
fputc(40,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp);//Format-Header-Laenge
j=xdim%256; fputc(j,fp); //Bildbreite
j=(xdim%(256*256))/256; fputc(j,fp);
j=(xdim%(256*256*256))/(256*256); fputc(j,fp);
j=xdim/(256*256*256); fputc(j,fp);
j=ydim%256; fputc(j,fp); //Bildhoehe
j=(ydim%(256*256))/256; fputc(j,fp);
j=(ydim%(256*256*256))/(256*256); fputc(j,fp);
j=ydim/(256*256*256); fputc(j,fp);
fputc(1,fp);fputc(0,fp); //Anzahl der Ebenen
fputc(8,fp);fputc(0,fp); //Bits pro Pixel
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp); //Kompression
i=xdim*ydim;
j=i%256; fputc(j,fp); //Groesse der Pixeldaten
j=(i%(256*256))/256; fputc(j,fp);
j=(i%(256*256*256))/(256*256); fputc(j,fp);
j=i/(256*256*256); fputc(j,fp);
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp); //x-Auflösung(in Pixel pro Meter)
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp); //y-Auflösung(in Pixel pro Meter)
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp); //Anzahl genutzter Farben
fputc(0,fp);fputc(0,fp);fputc(0,fp);fputc(0,fp); //Anzahl wichtiger Farben
//1kB einfuegen jedes mögliche Byte wird dreimal wiederholt und dann ein Nullbyte angefuegt
for(i=0;i<256;i++){fputc(i,fp);fputc(i,fp);fputc(i,fp);fputc(0,fp);}
//Bild an der y-Achse spiegeln: Bild faengt bei bmp links unten an.
for(j=ydim-1;j>=0;j--){
for(i=0;i
|
|
|
|
|
thanks man, i'll look into it ))
|
|
|
|
|
Hi, everyone!
In the following example,
--------
void function(void (*pfunction )(void *))
{
int socket;
//init socket ...
pfunction = functionA;
pfunction ((void*) socket);
}
void functionA (void* InSocket)
{
int socket = (int)(InSocket)
//so some operations
}
--------
I have two questions:
1. I do not know why should we user "void*" as the
parameter list of functionA and not just "int"?
Which way is better? What is the advantage of using
"void*" instead of "int"? Can you show me an example?
2. I have known that we can convert void* to a pointer
type and vice versa. Can we convert void* to a non-pointer
type and vice versa? As shown in this example. What is the
advantage of the usage?
Thanks in advance,
George
|
|
|
|
|
I use void* for windows messages, where you can only pass WPARAM and LPARAM. THis way I can create a pointer to a class with my data using new, and then do my PostMessage(), them I can reinterpret the pointer to the proper datatype, use the data, and delete it when I'm done. Other than that, I never really had a use for it, except when starting threads with AfxBeginThread().
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
Thanks, Nitron buddie!
Your experience is valuable to me.
regards,
George
|
|
|
|
|
Hi, everyone!
Suppose there is a static variable in a function, for example,
--------
void FunA()
{
static int a = 1;
if (1 == a)
{
//do operation 1
a = 0;
}
return;
}
--------
The above function FunA is called in a multi thread environment.
I mean each thread calls this function many times.
I think *operation 1* will only be done at the first time when
the FunA is called by a thread. After that, *operation 1*
will not be invoked by other threads.
Am I correct?
Thanks in advance,
George
|
|
|
|
|
That is incorrect. Say two threads call FunA() at about the same time (one after the other). Thread 1 is in the "do operation 1" code when its time slice expires and it is interrupted. Thread 2 then runs and starts executing FunA() as well. It manages to get through the "do operation 1" code and sets a to 0 before it is interrupted. Some time later, Thread 1 gets CPU time again and finishes FunA(), again setting a to 0. So that code block has been executed more than once.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"You have Erica on the brain" - Jon Sagara to me
|
|
|
|
|
Thanks, Michael buddie!
I think I should define the if block as a
critical region, so that *operation 1* will be
invoked only once.
Am I correct?
Thanks in adavnce,
George
|
|
|
|
|
George2 wrote:
Am I correct?
Yes
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|