|
Right, I didn't see that forum. thanks
|
|
|
|
|
I'm calling:
Graphics.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
but still it doesn't work. My Metafile object is drawn without antialiasing.
Does anyone know why?
Thanks!
[b]yte your digital photos with [ae]phid [p]hotokeeper - www.aephid.com.
|
|
|
|
|
Hello,
I am doing a conversion of a unsigned --int64 to binary using 2003 and does not seem to work. This code works with VC++ 6.0.
In My header file i define a structure
#define QWORD unsigned __int64
#define NUM_EVENTS 53
struct SList // sl
{
int idObject;
int EMPTY_OBJECT_ID;
BOOL aEvents[NUM_EVENTS];
SList() : idObject(EMPTY_OBJECT_ID)
{ ::memset(aEvents, 0x00, sizeof(aEvents)); }
SList(int id) : idObject(id)
{ ::memset(aEvents, 0x00, sizeof(aEvents)); }
SList(int id, QWORD qwEnabled)
{
SList();
idObject = id;
for (int i = 0; i < NUM_EVENTS; i++)
aEvents[i] = 0 != (qwEnabled & (QWORD)(1 <<
(QWORD)i));
}
};
In My cpp file i am populating a temporary list,
int id =12345;
QWORD qEnable = 9007191738548223;
CArray <SList*, SList*> aSList;
SList* psl = new SList(id, qEnable);
// Add them to a temporary list.
aSList.Add(psl);
Anyone having any idea whether there is any patch to rectify? Pls help
Anil
|
|
|
|
|
What is the problem that is occuring?
What if you use the LL suffix on your QWORD literals...
for (int i = 0; i < NUM_EVENTS; i++)
aEvents[i] = 0 != (qwEnabled & (QWORD)(1LL <<
(QWORD)i));
Also have you applied SP1 to VS2003?
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
That Worked, thanks alot.
|
|
|
|
|
Hello all
Im having an issue with trying to write a class that allows me to create a method for socket handle reuse but its not working so good I can always create the directory but when I goto write the file I get handle invalid errors(specifically the hConnectionHandle), its definately a handle issue. Im thinking im missing some obvious and important step here can anybody help, here is the basic pseudo code of what im trying to do.
I do not have my original code to post for Debug, but below shows all the steps I took to try and reuse the HANDLES minus any exception handling and debugging routines. Im trying to see if anyone has done something like this before and can point out where I'm missing a step or off base or what?
again the error always was an invalid handle (hConnectionHandle)on second reuse in WriteFile each and everytime.
class FTPjunk
{
public:
FTPjunk();
HINTERNET hOpenHandle;
HINTERNET hConnectionHandle;
bool SetHandles(string mode);
bool CreateDirectory(string directory_name);
bool FTPjunk::WriteFile(string file_name);
private:
~FTPjunk();
};
FTPjunk::FTPjunk()
{
hOpenHandle = null;
hConnectionHandle = null;
}
FTPjunk::~FTPjunk()
{
}
bool FTPjunk::SetHandles(string mode)
{
if(mode == "OPEN") {
hOpenHandle = InternetOpen(lpszAgent,
dwAccessType,
lpszProxyName,
lpszProxyBypass,
dwFlags);
hConnectionHandle = InternetConnect(hOpenHandle,
lpszServerName,
nServerPort,
lpszUsername,
lpszPassword,
dwService,
dwflags,
0);
}
else if(mode == "CLOSE") {
InternetCloseHandle(hOpenHandle);
InternetCloseHandle(hConnectionHandle);
}
}
bool FTPjunk::CreateDirectory(string directory_name);
{
SetHandles("OPEN");
FtpCreateDirectory(hConnectionHandle, directory_name);
SetHandles("CLOSE");
return true;
}
bool FTPjunk::WriteFile(string file_name);
{
SetHandles("OPEN");
FtpPutFile(hConnectionHandle,
file_name,
file_name,
dwflags,
0);
SetHandles("CLOSE");
}
}
int main()
{
FTPjunk ftpjunk = new FTPjunk();
ftpjunk->CreateDirectory("test_directory");
ftpjunk->WriteFile("test_file");
return 0;
}
-- modified at 15:13 Monday 26th February, 2007
|
|
|
|
|
I can't see anything that should cause a reuse problem here.
I would recommend switching the InternetCloseHandle() calls (close the hConnectionHandle first)
and set the handles back to null after they are closed.
Then use the debugger and step through to find the call that is failing and why (using
GetLastError())
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
yeah I know and it worked part of the time, Ill try what you said reversing the order and resetting to null, appreciate it I post what i find
AJ
|
|
|
|
|
Big upps to Mark, that worked like a champ I knew it was some stupid thing I was overlooking my code and I both thank you.
Here was the change I did:
bool FTPjunk::SetHandles(char * mode)
{
if(mode == "OPEN") {
hOpenHandle = InternetOpen(lpszAgent,
dwAccessType,
lpszProxyName,
lpszProxyBypass,
dwFlags);
hConnectionHandle = InternetConnect(hOpenHandle,
lpszServerName,
nServerPort,
lpszUsername,
lpszPassword,
dwService,
dwflags,
0);
}
else if(mode == "CLOSE") {
<font color=red>InternetCloseHandle(hConnectionHandle);
InternetCloseHandle(hOpenHandle);
hConnectionHandle = NULL;
hOpenHandle = NULL;</font>
}
}
|
|
|
|
|
That was really a lucky guess.
I just think it's a good idea to free objects in reverse order of creation when one of the
objects depends on the other for its creation (ie InternetConnect needs a handle from
InternetOpen). Especially with "handles", with which there's no way of knowing what goes on
behind the scenes in a seemingly simple "CloseHandle" call.
Setting to NULL is just generally considered good form (unnecessary in destructors for member
variables) and more importantly, it makes it easier to debug - NULL values are easily spotted
while debugging, invalid handle values are extremely hard to spot
I'm glad it worked for you!
Cheers,
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
I am trying to access a dll from vc++ code using the below code.
typedef BOOL (CALLBACK* GetUserNameA)(LPTSTR,LPDWORD);
HINSTANCE hDLL; // Handle to DLL
GetUserNameA lpfnDllFunc1; // Function pointer
LPTSTR dwParam1=(LPTSTR)" ";
LPDWORD uParam2=(LPDWORD)32;
BOOL uReturnVal;
hDLL = LoadLibrary("F:\\DLL\\advapi32\\advapi32.dll");
if (hDLL != NULL)
{
lpfnDllFunc1 = (GetUserNameA)GetProcAddress(hDLL,
"GetUserNameA");
if (!lpfnDllFunc1)
{
// handle the error
FreeLibrary(hDLL);
//return SOME_ERROR_CODE;
}
else
{
// call the function
uReturnVal = lpfnDllFunc1(dwParam1, uParam2);
}
}
But when i call the function as uReturnVal = lpfnDllFunc1(dwParam1, uParam2);
I get an access violation error. Could someone give me a hint regarding what could have went worng.
Vin
|
|
|
|
|
vinith wrote: Could someone give me a hint regarding what could have went worng.
You are passing a pointer to a buffer that is only 2 characters long, yet you pass 32 as it's
length. Chances are pretty good the function is trying to overrun the end of your buffer.
Also the second parameter is expecting a pointer to a DWORD. "LPDWORD uParam2=(LPDWORD)32;"
creates a pointer to address 32 which is invalid.
Either of the above two problems will most likely cause an access violation.
Try:
TCHAR szParam1[32]={0};
DWORD uParam2 = 32;
...
uReturnVal = lpfnDllFunc1(szParam1, &uParam2);
*EDIT* Actually you are forcing the call to the non-Unicode API so it should be:
char szParam1[32]={0};
DWORD uParam2 = 32;
...
uReturnVal = lpfnDllFunc1(szParam1, &uParam2);
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
|
vinith wrote: I get an access violation error.
What call stach says about this ?
|
|
|
|
|
Hi all
I have a ActiveX control which is to be used with MS Access. Now my question is that does the control tested with MS access 97 will work fine with all the later versions of MS access?
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
With just the information you've provided, you're the only one in a position to answer such a question. Does your control use something specific to Access 97?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I have created a program for carpet factory which ask user all the detail and then stores the final quotation to the file, which can be displayed later.
The following function reads file and counts the number of entry and return the count to main to sort out reference number, reference number starts from 1000 and now every time user input data, next reference number should be provided.
int FillCustomersArray()
{
const int BUFF_LEN = 256;
char Buffer[BUFF_LEN];
fstream InFile;
CustNum = 0;
InFile.open("Quotes.txt", ios::in);
if(InFile.is_open())
{
while(!InFile.eof())
{
InFile >> ws;
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].QuoteNumber = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
strcpy(Customer[CustNum].Name, Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].DeliveryCost = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].CarpetCost = atoi(Buffer);
InFile.getline(Buffer, BUFF_LEN);
Customer[CustNum].Guarantee = atoi(Buffer);
CustNum++;
}
}
InFile.close();
return CustNum;
}
Everything is working allright, except this small error...just have look to below stored file..
1005
Rotton J
3840.00
2536.00
5
1006
Brocket L
1100.00
0.00
11000
1007
gbush
1452
0
1
1009
gibson
2772
0
1
1010
BOB MARTIN
2772
1108.8
1
1011
JACOB
6006
1108.8
2
The first number is reference number, so till 1006 its all fine as these details were already existed in file and now 1007 is inputed correctly but after this the reference 1009 is taken and leaving 1 more line. So the gap between quotes is increased by 1 line and 1008 reference number is not used. And now all numbers would go in sequence but the space has increased to two white lines...
Daoes anybody know whats going on here.
I know its quite simple problem but i am not able to get hold of it...
Thanks a lot
|
|
|
|
|
Hmm, that function looks well. Maybe the file contains exacly what you've got after reading it. Maybe problem occured during saving the file. Have you looked into the file with for example notepad.exe to see what it contains? Have you tried to use debugger? And try to give us some more details.
|
|
|
|
|
yeh i used debugger and its reading white space as a input giving 0 value to every field and steping to reference 1009 and from here onwords its fine with 2 white line gap.....
If you want i can post my main() here ...
thanks
|
|
|
|
|
Its very strange behaviour. I would have to run this project on my computer to see what happens. I can't tell you what's wrong just from your description.
Why the "1008" is so different? What is so special about this?? You didn't give me the answer if the file really contains fields:
1008
blabla
.
.
.
blabla
Maybe there is no 1008 case? Maybe the file contains just white space in that raw?
I've created Quotes.txt and pasted your list adding position/case 1008 and making 1 white space between each case. Then I've pasted your code to my simple reading from that file program, and everything was ok. Whole file was read properly. So again maybe your file has got some wrong items written earlier.
|
|
|
|
|
Hi
I have a activex control developed in VC++.
The graphics in the control is created using GDI. Now I want the windows XP themes to be applied to this control also.
What is the best way to do it.
Am not deriving the control from any Control class.
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I would suggest looking into the DrawTheme*(...) functions, and other Theme-related functions, and use them to get the active Theme and draw the "theme-able" parts of your control(s).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thank you very much.
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
I have developed an application in VS 2005.
It is giving the following error when i click a button on the form.
An Unhandled Win32 exception occured in abc.exe[2572]
with the title "Visual Studio Just-In-Time Debugger"
What may be the problem? What does the number 2572 signify?
Thanks
|
|
|
|
|
The problem is likely a programming error. Let the debugger attach to the process so you can see where the problem is.
The number after the executable is the Process ID (PID) for the running process.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|