15,903,012 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by April2004 (Top 20 by date)
April2004
10-Oct-12 12:12pm
View
Deleted
#include <stdio.h>
#include <conio.h>
#include <string.h>
void outputshort(int i);
void outputint64(int i);
short mem[100];
void main(){
FILE* fp = 0;
short x[100];
char *filename = "C:\\chk\\test.dat";
fp = fopen(filename, "wb");
if (fp) {
for (int j = 0; j < 10; j++){
x[j] = (short)j;
fwrite(&x[j], 1, sizeof(x[j]), fp);
}
__int64 val = 9151314442816847742;
fwrite(&val, 1, sizeof(val), fp);
for (int j = 10; j < 20; j++){
x[j] = (short)j;
fwrite(&x[j], 1, sizeof(x[j]), fp);
}
__int64 val1 = 9114441220867751806;
fwrite(&val1, 1, sizeof(val1), fp);
}
fclose(fp);
FILE* fr = fopen(filename, "r");
if (fr) {
fread(&mem, sizeof(mem), 1, fr);
}
outputshort(9);
outputint64(24);
_getch();
}
void outputshort(int i) {
printf("short value is : %d\n", mem[i]);
}
void outputint64(int i) {
__int64 app1 = (__int64)mem[i+3] << 48;
__int64 app2 = (__int64)mem[i+2] << 32;
__int64 app3 = (__int64)mem[i+1] << 16;
__int64 app4 = (__int64)mem[i];
__int64 app = (__int64)app1 | (__int64)app2 | (__int64)app3 | (__int64)app4;
printf("int64 value is : %I64x", app);
}
April2004
10-Oct-12 12:11pm
View
Hi,
Here is my simple source code. I just cut out the points of my current problem.Thanks for your help.
#include <stdio.h>
#include <conio.h>
#include <string.h>
void outputshort(int i);
void outputint64(int i);
short mem[100];
void main(){
FILE* fp = 0;
short x[100];
char *filename = "C:\\chk\\test.dat";
fp = fopen(filename, "wb");
if (fp) {
for (int j = 0; j < 10; j++){
x[j] = (short)j;
fwrite(&x[j], 1, sizeof(x[j]), fp);
}
__int64 val = 9151314442816847742; //7E FF FF FF FF FF FF 7E
fwrite(&val, 1, sizeof(val), fp);
for (int j = 10; j < 20; j++){
x[j] = (short)j;
fwrite(&x[j], 1, sizeof(x[j]), fp);
}
__int64 val1 = 9114441220867751806; //7E 7C FF FF FF FF FF 7E
fwrite(&val1, 1, sizeof(val1), fp);
}
fclose(fp);
FILE* fr = fopen(filename, "r");
if (fr) {
fread(&mem, sizeof(mem), 1, fr);
}
outputshort(9);
outputint64(10);
_getch();
}
void outputshort(int i) {
printf("short value is : %d\n", mem[i]);
}
void outputint64(int i) {
__int64 app1 = (__int64)mem[i+3] << 48;
__int64 app2 = (__int64)mem[i+2] << 32;
__int64 app3 = (__int64)mem[i+1] << 16;
__int64 app4 = (__int64)mem[i];
__int64 app = (__int64)app1 | (__int64)app2 | (__int64)app3 | (__int64)app4;
printf("int64 value is : %I64x", app);
}
Best Regards
April2004
19-May-12 14:11pm
View
Hello,
Thank you very much for helping me several times. I found that above code is very effective for me. Now, I have additional desires on it.
In above code - Within one function, load the bitmap and set pixel on it.
My additional desires - In one function (for example: OnInitDialog), I load the bitmap. Set the pixel in another function (for example : ShowPixel). When the timer arrive specified time (for example : 1 minute), the based bitmap is stand still as it is loaded. And I just want to redraw ShowPixel with another different pixel color. Based on your code, I tried several times to get my requirements. But until now, I can't get solution yet. If possible, could you please guide me on it? Thanks again.
April2004
17-May-12 10:27am
View
Thank you very much for your advice.
Actually, I would like to fill various color in Rectangle. I need to set color, brush in for loop. My desire based on your concept is such as:
for (int i = 0; i < bmpInfo.bmHeight; i++) {
for(int j = 0; j < bmpInfo.bmWidth; j++) {
Gdiplus::SolidBrush brush(Gdiplus::Color(128, rand()%100, rand()%20, rand()%100));
g.FillRectangle(&brush, j, i, 1, 1);
}
}
With above code, I found that it is very slow to fill rectangle.
Could you please guide me any solution for speedy ?
And when the timer is arrive to target time(eg. 10 minutes), I would like to refill the rectangle with another various color. If I didn't clear the previous color, the correct color can't be displayed in next time. So, could you please guide me for the fastest way to clear Rectangle ?
April2004
14-May-12 12:35pm
View
I copied your code and run it. I can see the output is what I want. Thank you very much. Now, I am trying to understand your code.
April2004
14-May-12 12:35pm
View
Ok. I will study it. Thank you for your guideline.
April2004
14-May-12 12:21pm
View
AlphaBlend() is totally new for me. Thank you very much for your advice. I will study about it. If you have an example or reference links, could you please point it out for me? Thank you again JackDingler.
April2004
14-May-12 12:11pm
View
Thank you very much for your advice.
May be my misunderstanding. I tested as you said. If I comment out the first BitBlt, the Base Bitmap can be shown on screen. Any idea on it ?
Thanks again.
April2004
14-May-12 12:09pm
View
"What you could try to do is creating an intermediate buffer, do those blits and pixel modifications on this buffer, and then blit this buffer onto the screen"
Thank you for your advice. Could you please give me an example of intermediate buffer or the link to refer it ? I am trying a lot of ways. But, cant solve until now. Again, Thank you very much.
April2004
22-Apr-12 12:06pm
View
Suppose, I load Circle shape bitmap in OnInitDialog. Then, I paint the red color on it. I would like to see the Circle even after the red color is painted. With the above code, I just can see the red color as the red color is covered on the circle.
That is the meaning of transparent that I want. Thank you very much for care of my problem.
April2004
22-Apr-12 11:49am
View
Thank you very much for your help. I tried with the first block of the first article that you said. There are some errors of CMemDC at DrawTransparentBitmap function. Actually, I don't know how to solve it. Until now, I can't get the solution yet.
April2004
22-Apr-12 9:05am
View
Espen Harlinn, thanks for your advice.
I think I just need to modify or add one or two things on my code.
But I dont know yet what are the problems.
Any idea on my code ?
With Regards,
April2004
April2004
11-Apr-12 12:34pm
View
Great! I got the expected output after trying with your code. Thank you very much.
Actually, not only for printing in console, my purpose is also to save this double data in local double array. How should I do? Do I need to convert Char to Double?
April2004
11-Apr-12 12:15pm
View
Check contents by dragging .dat file to notepad.
Here I found the data in file.
41.000000 67.000000 34.000000 0.000000 69.000000 24.000000 78.000000 58.000000 62.000000 64.000000
April2004
25-Jul-11 2:14am
View
Sorry.. I should tag above problem as C++, XmlReader. Thanks for your comment.
Do you have any solution for my problem ? With thanks...
April2004
12-Mar-11 13:08pm
View
I think Microsoft Paint Canvas is not based on CButton. Am I right?
I would like to get the one similar to Microsoft Paint Canvas. If you have some ideas, please let me know.
April2004
10-Mar-11 9:55am
View
My problem is solved by your updated answer. Thank you very much for your updated answer. ^^
April2004
9-Mar-11 11:39am
View
I'd already tried with "if" condition that you mentioned. But it doesn't work. For dropdown style, owner drawn fixed combo box, nCtlColr is equal to CTLCOLOR_EDIT. Am I right? Then, even though I don't know the reason, pWnd->GetDlgCtrlID() is not equal to IDC_COLOR_COMBO. So, that condition is never true and with above mentioned "if" condition, color combo box also doesn't work.
Thank you for your suggestion. I am still finding the solution now. If you have other idea, please let me know. With Regards..
April2004
9-Mar-11 11:26am
View
Hi, thank you very much for your comment. I'd already tried with "if" condition as you mentioned. But, if I do like that, it even can't change color of IDC_COLOR_COMBO.
I don't know the reason exactly. When I see in debug mode, if I operate combo box, nCtlColor is equal to CTLCOLOR_EDIT and pWnd->GetDlgCtrlID() is not equal to IDC_COLOR_COMBO. Therefore, that condition is always false and color display coding is never worked. Any idea on that? Thanks again.
April2004
4-Mar-11 20:36pm
View
Thank you very much for your solution.
It works well and my problem is solved by your solution.^^
Show More