|
Everyone was a newbie once...
There are MANY (legions) of books available... I wouldn't promote piracy (no, not me!), but several are even available in various places on the net, if you know where to look...
Teach Yourself Visual C++ in 21 Days (ambitious title)
Visual C++ Unleashed
etc...
Both take you step by step through different projects and teach you WHAT you can do so you can learn HOW to do it...
If you are like me, you would want a real-print version of the book so you can thumb through it...
Good luck!
=->Mocs<-=
|
|
|
|
|
HI.ALL
I M GETTING THIS PROBLEM......
c:\program files\microsoft visual studio\myprojects\dialog1\dialog1dlg.cpp(4) : fatal error C1083: Cannot open precompiled header file: 'Debug/dialog1.pch': No such file or directory
Clicking on error.it points to
#include "stdafx.h"
and my code is this.....
void CDialog1Dlg::OnAdd()
{
// TODO: Add your control notification handler code here
CString strTitle ;
int nIndex;
UpdateData(); // Transfer data from controls to variables
//get currently selected text
nIndex = GetDlgItemText(IDC_TITLE, strTitle); //assigning selected
m_strFullName = strTitle + " " + m_strFirstName + " " + m_strLastName;
m_NameList.AddString(m_strFullName); //Add string to list
UpdateData(FALSE); // Transfer data from variables to controls
}
SKDOBHAL
|
|
|
|
|
#include "stdafx.h" must be the first include statement before the others
|
|
|
|
|
|
Does this error happen even with a Rebuild All?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
using VC++, how to cut a rectangle segment picture from an bmp format image?
and the cutting rectangle can has diffrent angle. my mean is that the cutted image is certainly rectangle, and the cutting segment is also rectangle, but the tow rectangles are not parallel, there is a rotated angle between them.
thanks
|
|
|
|
|
See this code
CDC m_dc,m_dc2;
m_dc.CreateCompatibleDC(GetDC());
m_dc2.CreateCompatibleDC(GetDC());
HBITMAP hbit=CreateCompatibleBitmap(GetDC()->m_hDC,800,600);
HBITMAP hbit2=CreateCompatibleBitmap(GetDC()->m_hDC,800,600);
hbit=(HBITMAP)m_dc.SelectObject(hbit);
hbit2=(HBITMAP)m_dc2.SelectObject(hbit2);
hbit=(HBITMAP)LoadImage(NULL, _T("c:\\1234.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
hbit=(HBITMAP)m_dc.SelectObject(hbit);
m_dc.TextOut(0,0,_T("And is this your answer"),23);
m_dc2.BitBlt(300,300,200,200,&m_dc,0,0,SRCCOPY);
hbit2=(HBITMAP)m_dc2.SelectObject(hbit);
CImage m_Image;
m_Image.Attach(hbit2);
m_Image.Save(_T("e:\\test.bmp"));
m_Image.Destroy();
m_dc.DeleteDC();
m_dc2.DeleteDC();
DeleteObject(hbit);
DeleteObject(hbit2);
|
|
|
|
|
That leaky piece of code helps the OP how?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Besides the fact that it has nothing to do with the question asked?
Like I stated, it leaks. "Only" one GDI object - you get lucky - the system
cleans up most of the problems. Here's an analysis:
CDC m_dc,m_dc2;
m_dc.CreateCompatibleDC(GetDC());
m_dc2.CreateCompatibleDC(GetDC());
HBITMAP hbit=CreateCompatibleBitmap(GetDC()->m_hDC,800,600);
HBITMAP hbit2=CreateCompatibleBitmap(GetDC()->m_hDC,800,600);
hbit=(HBITMAP)m_dc.SelectObject(hbit);
<font color="Red">
hbit2=(HBITMAP)m_dc2.SelectObject(hbit2);
<font color="Red">
hbit=(HBITMAP)LoadImage(NULL, _T("e:\\8bit.bmp"), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
<font color="Red">
hbit=(HBITMAP)m_dc.SelectObject(hbit);
<font color="Red">
m_dc.TextOut(0,0,_T("And is this your answer"),23);
m_dc2.BitBlt(300,300,200,200,&m_dc,0,0,SRCCOPY);
hbit2=(HBITMAP)m_dc2.SelectObject(hbit);
<font color="Red">
CImage m_Image;
m_Image.Attach(hbit2);
m_Image.Save(_T("e:\\8bit_test.bmp"));
m_Image.Destroy();
<font color="Red">
m_dc.DeleteDC();
m_dc2.DeleteDC();
DeleteObject(hbit);
<font color="Red">
DeleteObject(hbit2);
<font color="Red">
<font color="Red">
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hey Mark thanks for your help.
|
|
|
|
|
Hi..
Previously I was using Modal dialog box with Thread, to continue one process and showing the dialog box continuously. But as I am getting problem with thread I need to use Modeless dialog Box. But when I replace the code of Modal Dialog box with Modeless Dialog Box. It hangs when redrawn.
i.e. When it redrawns nothing displays in the dialog box.
The Code I am using is as follows
My application is such, that continuously check the data from the server and displys on the dialog.
hDisOwnDlg=CreateDialog( g_hInst, MAKEINTRESOURCE( IDD_DISOWN ), NULL, DisOwnDlgProc );
ShowWindow(hDisOwnDlg,SW_SHOW);
Please Help me.
-- modified at 10:11 Thursday 1st November, 2007
|
|
|
|
|
Did you use of any function or event like WM_SIZE on your project? does your previous problem solve?
|
|
|
|
|
No i am not using WM_SIZE. and my previos problem hasn't been solved.
|
|
|
|
|
What thread are you creating the dialog on?
What thread do you do the continuous checking on?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have function that retrives the data from Internet Server throught Socket after some interval and show it on the dialog box. Previously I was using Modal Dialog box, calling this function through thread before creating dialog and termination thread when Dialog Ends.
But I think if I will use the Modeless Dialog box the above thing will be much easy. And So replaced the code of modal dialog box with Modeless Dialog box. But as I told earlier it gets blank when it redrawns.
|
|
|
|
|
Mark Salsbery wrote: What thread are you creating the dialog on?
What thread do you do the continuous checking on?
Well if you're doing processing on the same thread the modeless dialog
was created on, then that can cause the dialog not to get its
WM_PAINT messages (and any others).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi,
I have created a Local User Account programmatically say "MyUser" and then Iam Creating a process as MyUser. From within this process( which means Iam working as "MyUser") I have created a Pdf file and then Iam trying to open it Programmatically using DOS command "cmd /c start myfile.pdf". But the Pdf file is not getting opened. Even when I click on it. It Says "Access denied". The Same file if I login using "MyUser" it is being opened.Then after If Iam trying to Open it Programmatically or Normally I could open the File from my current user Account.
So,Is it a must for me to login as "MyUser" atleast once to work with that user Programmatically?
What I observed is once I login as that user, In Documents and Settings a folder is created under the name "MyUser".
So Is there any thing more I need to do apart from creating a user Programmatically?
Any suggestions would be helpful.
Thanks in Advance.
Today is a gift, that's why it is called the present.
|
|
|
|
|
Firstly, do you know the freshly created pdf exists?
If so, it probably was created so that only MyUser can open it.
Forgetting acrobat etc - can you copy the file using explorer? If not, then you may need to modify the CreateFile code that MyUser runs to use a security context (one of the params that's usually NULL) to create the file with "everyone can read this" privileges.
*Then* worry about whether the file is decent.
You may even want to start testing by creating a text file with "hello" in it, so you can use simpler software to check things out.
Iain.
|
|
|
|
|
narayanagvs wrote: Iam trying to open it Programmatically using DOS command "cmd /c start myfile.pdf".
Why not just use ShellExecute(hWnd, "open", "myfile.pdf", ...) ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
My application works as below.
Client sends its MAC address and Wait time(in seconds) to server and goes to sleep state.
Server receives them and sleeps for received no. of seconds. After that time period, server sends Magic Packet to client to wake it up.
Now the problem is, if Client sends Wait Time less than 120 seconds, server wakes up the client successfully. But if that time period is 120 or greater than 120, client does not wake up even if server sends magic packet successfully. What could be probable cause for the same.
|
|
|
|
|
Hello,
I have a CDatabase object.But the following ExecuteQuery doesn't work.It gives an error "Syntax error in field definition"
CDatabase CurrentDatabase;
CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt decimal(10,2))");
but
the following works
CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt int)");
I have checked with SQL both the statements have right syntax.
What must be the problem?
Prithaa
|
|
|
|
|
prithaa wrote: CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt decimal(10,2))");
Can you execute this statement from within SQL itself? Have you tried:
CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt decimal(10))"); or
CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt decimal)");
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
Thanks for your reply.
I tried te syntax with Access it did not work in Access.
I want to create a table with a float field.I checked the SQL Create command which says decimal(10,2) for decimal values.
But it doesn't seem to work .
What should I do for decimal vlues?
Prithaa
|
|
|
|
|
prithaa wrote: I checked the SQL Create command which says decimal(10,2) for decimal values.
It matters not what SQL says about the syntax, as you are creating the table within Access. Check its documents instead.
prithaa wrote: What should I do for decimal vlues?
Have you tried:
CurrentDatabase.ExecuteSQL("Create Table Purchase (Amt double)");
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|