|
I know. Just my luck. however, had I known that when I started my search I would have found this:
http://www.codeproject.com/csharp/WebCacheTool.asp[^]
Hopefully this will act as a reference to anyone else.
Of course now I am finding plenty of wininet functions that can be used. I had that strange feeling in my gut that I should have done this toolbar in C++. Too late now
Thanks.
|
|
|
|
|
Hey Guys,
I'm using VC++ 6.0 and I'm having a very stupid problem. I get an unhandled exception error when try to output a string to console. Even the simplest program such as the one below:
main.cpp
#include "stdafx.h"
#include <iostream>
#include <string>
using namespace std;
void main(void )
{
string s = "test=2321";
cout << s;
}
Will produce an error. I built the same program in Metrowerks Codewarrior, and the program runs fine. No problems whatsoever. For some reason I have problems with it in VC++. This is what i have in my other include file:
stdfx.h
#if !defined(AFX_STDAFX_H__A9693917_A7C9_4A6A_B3E1_58638AE54078__INCLUDED_)
#define AFX_STDAFX_H__A9693917_A7C9_4A6A_B3E1_58638AE54078__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#include <iostream>
#include <string>
#endif // !defined(AFX_STDAFX_H__A9693917_A7C9_4A6A_B3E1_58638AE54078__INCLUDED_)
I will also list my project options:
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/testing_project2.pdb" /debug /machine:I386 /out:"Debug/testing_project2.exe" /pdbtype:sept
Does anyone know the reason why this is occuring? I would appreciate any light on the issue.
Thanks,
Robbie
-- modified at 18:50 Saturday 24th June, 2006
|
|
|
|
|
Do you have SP6 installed? I recall getting some very strange compiler/runtime errors on previous SPs. Mostly with _bstr_t , but I wouldn't be shocked if errors happened in other parts of the runtime libraries.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
Hey Mike,
I applied the update and also removed any intermidiate files as well as the precompiled header files, but still I am getting the same error. Do you think it could be an issue with the project options?
Robbie
|
|
|
|
|
I don't have a fix, just some clue. It has something to do with incompatible STL libraries. I encountered similar problem on a UNIX platform long time ago. We couldn't fix it cleanly because we were not allowed to alter the platform setup. But we were able to get rid of it by using old STL implementation.
Try to use old STL headers like string.h and iostream.h and see how it goes.
Best,
Jun
|
|
|
|
|
I used the following code in a simple VC 6 console project I use for testing purposes. I turned off precompiled headers, so the project should be unaffected by anything significant. The program works for me as it should, so you probably have something messed up by your setup.
#include <iostream>
#include <string>
using namespace std;
void main(void ){
string s = "test=2321";
cout << s;
}
-- modified at 21:36 Saturday 24th June, 2006
|
|
|
|
|
I use code like this all the time and have no problems. What is the exeption? Can you attach a call stack when the exception is thrown?
Steve
|
|
|
|
|
Hey guys,
Thanks for the input. I have a few question though:
1) How would I turn off the pre-compiled headers? Is it just as good as cleaning out the the intermediate and precompiled headers before a build or do I still need to turn them off?
2) I tried including iostream.h and string.h however that doesnt seem to work either. I still receive the same error.
3) As for the unhandled exception, its an access violation with error code: 0xC0000005, but I'm not sure how I would get the call stack. I can see it but windows does not export the log file for it, and I cant copy it from the error report window.
|
|
|
|
|
can i get help on wat this line does
response.redirect("login.asp?l=incorrect_login_or_password")
i understand the redirect part but wat is this " l=incorrect_login_or_password"
can anyone help me this....will be very greatefull....
thank you..
|
|
|
|
|
|
hey, I need some help passing a char. When the app. starts, it has an assertion failure, because the NetWkstaTransportEnum() function fails when I pass the netbios name of a server on my network to it. If I use NULL, it outputs the local MAC address.
#include "stdafx.h"
#include <Windows.h>
#include <lm.h>
#include <assert.h>
#pragma comment(lib, "Netapi32.lib")
static void PrintMACaddress(unsigned char MACData[])
{
printf("MAC Address: %02X-%02X-%02X-%02X-%02X-%02X\n",
MACData[0], MACData[1], MACData[2], MACData[3], MACData[4], MACData[5]);
}
static void GetMACaddress(void)
{
unsigned char MACData[8];
WKSTA_TRANSPORT_INFO_0 *pwkti;
DWORD dwEntriesRead;
DWORD dwTotalEntries;
BYTE *pbBuffer;
NET_API_STATUS dwStatus = NetWkstaTransportEnum(
"\\server",
0,
&pbBuffer,
MAX_PREFERRED_LENGTH,
&dwEntriesRead,
&dwTotalEntries,
NULL);
assert(dwStatus == NERR_Success);
pwkti = (WKSTA_TRANSPORT_INFO_0 *)pbBuffer;
for(DWORD i=1; i< dwEntriesRead; i++)
{
swscanf((wchar_t *)pwkti[i].wkti0_transport_address, L"%2hx%2hx%2hx%2hx%2hx%2hx",
&MACData[0], &MACData[1], &MACData[2], &MACData[3], &MACData[4], &MACData[5]);
PrintMACaddress(MACData);
}
dwStatus = NetApiBufferFree(pbBuffer);
assert(dwStatus == NERR_Success);
}
int _tmain(int argc, _TCHAR* argv[])
{
GetMACaddress();
return 0;
}
I think I may need to do a unicode conversion, but am not sure how. It may not even be that, as well. So, I need help passing the netbios name of a remote server (e.g. \\SERVER001), to the NetWkstaTransportEnum() function. All help is very much appreciated, thanks in advance.
salut
|
|
|
|
|
Prefix a string literal with L to make it Unicode, eg L"\\\\server001"
Note that you need to escape backslashes in a literal, so to create two backslashes you write \\\\
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
VB > soccer
|
|
|
|
|
tried that using : char *netbios = L"\\\\server";
...but, compiler says this : error C2440: 'initializing' : cannot convert from 'unsigned short [10]' to 'char *'
...at this line in my source:
NET_API_STATUS dwStatus = NetWkstaTransportEnum(
netbios,
0,
&pbBuffer,
MAX_PREFERRED_LENGTH,
&dwEntriesRead,
&dwTotalEntries,
NULL);
kinda new to conversions, all help is appreciated. thanks in advance
salut
|
|
|
|
|
|
hey mike, thanks for the heads up on that. It seems I am doing it wrong, because the compiler still says the same thing as I said in my last post. It can not convert an unsigned short * to char*. But, when I send a char* to the function, it raises an assertion failure. Have you actually tested the variable, to see if it works? It doesn't for me. thanks
salut
|
|
|
|
|
Anyone have some code to beautify xml??
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Hi everyone!
I need to compute a *PRECISE AND ACCURATE* BOUNDING rectangle around a text
I tried with several methods with Windows32 API(s)
- GetTextExtentPoint32
- DrawText (with DT_CALCRECT)
- GetCharWidth32 (Obtaining the width of every char of the string)
I'm using MM_ANISOTROPIC mapping into my device context and seems that the X-Extension of the text is always different by the effective text drawned into the device. This happen when the zoom/scale factor is different by 1.0
What i'm doing of wrong?
Please help me
Thank you
Furno Gianluca
|
|
|
|
|
All,
I have written a COM Object in C++. I have a C# application that calls this COM object. One method in the COM object requires a variable to be modified to inform C# of an error. I create a variable of type Object in C Sharp and pass it by reference to the COM method. The com method receives this variable as a VARIANT*. In my C++ method I use variant_t to assign the integer value I want and assign it to the VARIANT* passed to the COM Method. This seems to work well in Debug mode but in Release I get the following error:
An unhandled exception of type 'System.NullReferenceException' occurred in CSharp Test Harness.exe
Additional information: Object reference not set to an instance of an object.
Can anyone help unscramble what I am doing wrong or offer a suggestion as to how to code this properly.
Kind regards
Dave
|
|
|
|
|
Hello everybody,
i have a problem with the OnEnable method : once it is used, the normal
display of the CWnd item doesn't work well (not fully grayed if disabled). A
possible workaround is the call the CWnd::RedrawWindow() inside the OnEnable
method, but it works only with VC++8, and i developp with VC++7.
Does anyone of you have a fix for this problem with VC++7 ?
Thanks
Gilles06600
|
|
|
|
|
What is that "CWnd item" which "doesn't work well"? A control?
Did you call the base class OnEnable method, like for example:
void CMyButton::OnEnable(BOOL bEnable)
{
CButton::OnEnable(bEnable);
}
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Hello,
you are right, to get the default enabling/disabling behavior of the CWnd, i have to call the base class method. I thought that the OnEnable method was just an empty shell provided by the MFC framework to put some extra code, but i was wrong. It really does some process.
So thank you for your help, my problem is solved
Gilles06600
|
|
|
|
|
It just calls the default window procedure which does its job:
_AFXWIN_INLINE void CWnd::OnEnable(BOOL)
{ Default(); }
LRESULT CWnd::Default()
{
_AFX_THREAD_STATE* pThreadState = _afxThreadState.GetData();
return DefWindowProc(pThreadState->m_lastSentMsg.message,
pThreadState->m_lastSentMsg.wParam, pThreadState->m_lastSentMsg.lParam);
}
You are welcome!
Ovidiu
|
|
|
|
|
it's a colorful icon or say it's 256 colors;
I want to load this icon to be a gray one!
is it existing a way to load ?
or it's impossible, on the other hand ,we shall prepare a gray one !
can it to be a gray one?
if it will do, how I load it?
waiting for answers!
Just my interest for these common things
|
|
|
|
|
If you want a monochrome icon then no sweat.
Call ::LoadImage and pass LR_MONOCHROME as load option.
HICON hIcon = (HICON)::LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(IDI_ICO_256COLOR),
IMAGE_ICON,
0, 0,
LR_MONOCHROME);
If you want a grayscale one, better is to "prepare" it yourself. There are tools that convert color icons to grayscale and Irfan View[^]is a free one.
Import the gray icon in your project resources, then load it like any others.
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
helloy all
i need some programs about gedir algorithm
in c++ language
or any links about it
thanks for all
|
|
|
|