|
When I'm working with DC's and Bitmaps, and BitBlts, I like to use the following utility from PJ Arends.
Image Viewer Utility[^]
It lets you debug your code, and see the results of image changes like a variable in a watch window.
Very handy, and a shame PJ isn't around CP anymore. (OK, hardly ever)
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
The following code can run correct in VC6.0,but in VC2005 it can not show the text.
Who can tell me why.
//m_pResult is a CEdit pointer
if(!m_pResult->IsWindowVisible())
{
CRect rect;
this->GetClientRect(rect);
m_pResult->MoveWindow(rect);
m_pResult->ShowWindow(SW_SHOW);
m_pResult->SetWindowTextA("aaaa\r\nbbbbb");
}
else
m_pResult->ShowWindow(SW_HIDE);
be my girl , OK?
|
|
|
|
|
liu3p wrote: m_pResult->SetWindowTextA("aaaa\r\nbbbbb");
May be the project is unicode. Use SetWindowText instead of SetWindowTextA
m_pResult->SetWindowText( _T("aaaa\r\nbbbbb"));
|
|
|
|
|
That is correct.
In VC 6.0 all projects are by default non-unicode.
In VS2005 all projects are by default unicode.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Done.Thank you.
be my girl , OK?
|
|
|
|
|
#include<stdio.h>
#define abs(x) ((x<0)?(-(x)):(x))
#define epsilon .000000000001
#define size 5
double multiply(a,m,product)
double a[size][size],product [size][size];
int *m;
{
int test=0;
int count,i,j,k,l;
double olda[size][size],diff;
for(i=0;i<*m;i++)
for(j=0;j(* m;j++)
olda[i][j]=a[i][j];
for(count=1;count<=1000;count++)
{
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
product[i][j]=0;
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
for(k=0;k<*m;k++)
product[i][j]=product[i][j]+a[i][k]*olda[k][j];
for(i=0;i<*m;i++)
for(j=0;j<*m;j++)
{
diff=abs(product[i][j]-olda[i][j]);
if(diff>epsilon)
{
test=1;
for(k=0;k<*m;k++)
for(l=0;l<*m;l++)
olda[k][l]=product[k][l];
}
break;
if(test<1)
{
printf("\nThe numberof iterations is:");
printf("\n");
printf("\n %d",count);
break;
}
test=0;
}
return(0);
}
main()
{
static double a[size][size]={{0.1,1.0,0.0,0.0,0.0},
{0.0,0.0,0.3,0.7,0.0},
{0.0,0.0,0.0,0.2,0.8},
{0.0,0.0,0.1,0.0,0.9},
{1.0,0.0,0.0,0.0,0.0}};
double product[size][size],pi[size],diff;
int test;
int m=size;
int i j;
multiply(a,&m,product);
printf("\n");
printf((" \nThe product is:");
printf("\n");
for(i=0;i<m;i<m;i++)
{
printf("\n");
for(j=0;j<m;j++)
printf(" %15.12f", product[i][j]);
}
printf("\n");
printf("n");
return(0);
}
I got the following error messages when I tried to compile it.
Error 1 error C2065: 'a' : undeclared identifier
Error 2 error C2065: 'm' : undeclared identifier
Error 3 error C2065: 'product' : undeclared identifier
Error 4 error C2448: 'multiply' : function-style initializer appears to be a function definition
Error 5 fatal error C1004: unexpected end-of-file found
Please help me I have been trying to figure out how to fix it.
Thanks
|
|
|
|
|
line #5 needs a semi-colon at the end.
|
|
|
|
|
There's several things wrong.
1/ You didn't read the posting guidelines, and put your code in pre tags, so there's no way on earth that I can be bothered to work may way through that wall of code.
2/ 1st error, as you've seen is a missing semi colon.
3/ 3rd error... When putting in tot prototype for your multiply function, you don;t say what kind of things a and m are. ints? doubles? struct Froobles?
OK, done now.
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need cotract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Hello Team ;
I have a library file (.LIB) with Password protect it. I'm looking for a recovery software or application or anyway to recover the password.
Any thought....
Please reply...
Thanks for all of your help.
|
|
|
|
|
Password? A LIB file? Naaaaa. Unless you mean a LIB file that isn't an object library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
That is correct. I do have a.Lib file and it is password protected. We would like to recover the password. so we can view the Lib ...
|
|
|
|
|
It's still doesn't make any sense...
As Stuart pointed out, a .lib file is not password protected. So, if you really want some help, I suggest you try to explain your problem in a much better way.
By the way, does it have anything to do with C++ ?
|
|
|
|
|
Its probably done by some package that encrypts the file and decrypts it on giving the right password.
I remember writing one during the old DOS days.
Now, will that work here...
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
DallasProgrammer wrote: I do have a.Lib file and it is password protected.
By what?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
(oh please say "a license key"! oh please oh please oh please)
|
|
|
|
|
Are the functions inside the lib file protected at runtime ? i.e. do they need a license to run?
This signature was proudly tested on animals.
|
|
|
|
|
Hi,
Am getting to grips with the g++ compiler...
I have my main cpp file containing the main function in
/home/alfred/Public/Test/
I have my header file in
/home/alfred/Public/Test/header/
I have my src file for the header in
/home/alfred/Public/Test/src/
I used the command
g++ -c -Wall -I/home/alfred/Public/Test/header/ myclass.cpp
to generate my myclass.o object file and then the archiver to create the library
ar rc mylib.a myclass.o
which was fine but now I am having problems compiling and linking the main.cpp file to get my exe. I am trying to use the command
g++ -L/home/alfred/Public/Test/src -I/home/alfred/Public/Test/header/ main.cpp -o a.out
but I am being returned the error
/tmp/ccmZLiDt.o: In function `main':
main.cpp text+0x59): undefined reference to `myclass::myclass(int, std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
collect2: ld returned 1 exit status
meaning that it cannot see the constructor for the class myclass. I thought the -L flag is to tell it where your library is which has the constructor definition? Ummm, am I getting confused with the -l flag?
Thanks for any information.
|
|
|
|
|
You still need to tell the linker which library to use. You can:
- Add mylib.a to the list of inputs (note that a.out is the default output name from the linker):
g++ -L/home/alfred/Public/Test/src -I/home/alfred/Public/Test/header/ main.cpp -o a.out mylib.a - You can rename the library so it starts with 'lib' - e.g. libmylib.a and then use the -l option by removing the 'lib' prefix:
g++ -L/home/alfred/Public/Test/src -I/home/alfred/Public/Test/header/ -lmylib main.cpp -o a.out
The -L option tells the linker what directory to look in for library files. The -l option tells the linker which library files to use.
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hey ya,
Many thanks for your tips, I tried both but unfortunately I got errors....
For the command line
g++ -L/home/alfred/Public/Test/src -I/home/alfred/Public/Test/header/ main.cpp -o a.out mylib.a
I got the error
g++: mylib.a: No such file or directory
and for the command line
g++ -L/home/alfred/Public/Test/src/ -I/home/alfred/Public/Test/header/ main.cpp -lmylib.a -o a.out
I got
/usr/bin/ld: cannot find -lmylib.a
collect2: ld returned 1 exit status
even though I have libmylib.a (where the -l substitututes the lib part).
Ummm, any ideas? Seems it still can't "see" the mylib.a
Many thanks!
|
|
|
|
|
minkowski wrote: For the command line
g++ -L/home/alfred/Public/Test/src -I/home/alfred/Public/Test/header/ main.cpp -o a.out mylib.a
I got the error
g++: mylib.a: No such file or directory
Sorry - for that one, you need the path to the lib on the command-line, not just the name
minkowski wrote: for the command line
g++ -L/home/alfred/Public/Test/src/ -I/home/alfred/Public/Test/header/ main.cpp -lmylib.a -o a.out
I got
/usr/bin/ld: cannot find -lmylib.a
collect2: ld returned 1 exit status
even though I have libmylib.a (where the -l substitututes the lib part).
Again - sorry, I forgot to say that you don't need the '.a' part either
HTH!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi ya,
Thanks for your reply. The folllowing worked....
g++ -L/home/mpotter/Public/Test/src/mylib.a -I/home/mpotter/Public/Test/header/ main.cpp -o a.out /home/mpotter/Public/Test/src/mylib.a
as opposed to
g++ -L/home/mpotter/Public/Test/src/ -I/home/mpotter/Public/Test/header/ main.cpp -o a.out mylib.a
which did not. also
g++ -I/home/mpotter/Public/Test/header/ main.cpp -o a.out /home/mpotter/Public/Test/src/mylib.a
works, so I am afraid I don't see the point of using the -L flag to give the location? you can just put the path on the end to your library and it will work fine.
I got the
g++ -L/home/mpotter/Public/Test/src/ -I/home/mpotter/Public/Test/header/ main.cpp -lmylib -o a.out
to work fine. This one with the -l flag makes sense as you use the -L to give the location and -l to give the library name. But the one with just the -L flag (the 1st case) does not make sense to me.... Can you pls explain?
Thanks !
|
|
|
|
|
The -L option is only relevant if you use -l to specify the library name. The g++ documentation[^] says:
<blokquote>-Ldir
Add directory dir to the list of directories to be searched for -l.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hey ya
Thanks for that. I can see now why it didn't work for the initial -L case. I thought the -L and -l were independent but apparently not !
|
|
|
|
|
Using MFC Dialog App with VC6
I need some help to force redraw of buttons?
I have a bitmap image displayed in my dialog using the picture control and have positioned over the top of it number of CButton's (ie the buttons overlap the image). I want to get the buttons to remain displayed when I change the bitmap image in the button selected function.
If I have an "OnSel" function for each button with code like this :
void CDesignEditDlg::OnButtonSel3() <br />
{<br />
MessageBox("Button 3 Pressed", "Select", MB_OK) ;<br />
<br />
}
When I run the app and press a button it is all fine, ie I get the button pressed message pops up and all the buttons are still shown.
Since I want to change the image displayed while the button is pressed I tried to modify my code to something like this.
void CDesignEditDlg::OnButtonSel2() <br />
{<br />
m_ctrlPageImage.SetBitmap(cBmp[1]);<br />
<br />
MessageBox("Button 2 Pressed", "Select", MB_OK) ;<br />
<br />
m_ctrlPageImage.SetBitmap(cBmp[0]);<br />
}
This works in that it changes the displayed image while the popup message is on screen but all the buttons other than the one I pressed have disappeared.
Is there a way to force MFC to redraw my buttons over the top of the image after I have changed it ??
|
|
|
|
|
Try adding the WS_CLIPSIBLINGS[^] style to your picture control, maybe add WS_CLIPCHILDREN to the dialog itself. If all that doesn't help, try using RedrawWindow[^] on your buttons.
> 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. <
|
|
|
|