|
It is in Kernel32.lib, at least this what worked on my machine (Win2k)
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|
|
What is the socket dll that holds its error description?
I use FormatMessage to translate winsock error.
when using the handle to WSock32.dll module i get different error description than in MSDN.
For example, error 10061 is "connection refused" but i get "Bad address".
error 10060 is "Connection timed out" but i get "permission denied".
This is the translation code:
LPVOID lpMsgBuf;
HANDLE hModule = GetModuleHandle("WSOCK32.dll");
FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_HMODULE |
FORMAT_MESSAGE_IGNORE_INSERTS,
hModule,
nErrorCode,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL
);
CString text = (LPCTSTR) lpMsgBuf;
LocalFree( lpMsgBuf );
Can anyone help me with this?
|
|
|
|
|
Hi guys:
I want to draw the caption bar of frame window in my own style,but the system button(CLOSE) always draw
by system unexpectedly, it cover my drawing. I remove the WS_SYSMENU attribute from windows style,but the
button of my application which shown on system taskbar has had no icon,I want it show icon on taskbar. How can I
resolve this problem, can anyone give me some instructions? Thanks!
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
I have two files:
a.txt:
20020102,23.0
20020103,23.0
.............
20021220,23.5
b.txt:
20010101,22
20010102,25
...........
20010301,35
Now I want to append the latest datas of the file "a.txt" to the file "b.txt". How could I do ! Please tell me the easy way to do it!
The focus is: I want appending the "latest" datas of a.txt to the file bb.txt
The latest datas in the file a.txt are the datas that are not included in the file b.txt.
Note: i only want to append the datas that the b.txt is not included.
Thanks a lot!
|
|
|
|
|
And what's the problem ? Could you show some code so we can really understand how we could help you ? How did you start ?
With your explanation, the only way to do that is pick up every line of a, check if it is in b, and append it if not. But if you could tell more about the file contents, and how they are updated, maybe we could find something less systematic.
~RaGE();
|
|
|
|
|
How to use UNICODE string in VC6
I use Visual C++ 6.0 with non-MFC (WindowsXPpro)
I wrote code that look like following
But in MessageBox, the message show a mash string, like a binary code,
Can you help me a way to solve problem ?
Thank!, thanks!
[code]
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
//IDS_WCHAR_APPTITLE = 104 = "Cộng hòa xã hội chủ nghĩa Việt Nam"
WCHAR buffer[100];
LoadStringW(hInstance,104,buffer, (WCHAR)sizeof(buffer));
MessageBoxW(NULL,(WCHAR*)buffer,NULL,MB_OK);
return FALSE;
}
[/code]
Visual C++ 6.0 don't support UNICODE string?
|
|
|
|
|
Hi friends !
Consider scenario
class A
{
public:
A()
{
cout << "In zero argument constructor";
}
A(int val)
{
cout << "In one argument constructor";
}
};
void main()
{
A *obj;
obj= new A[20];
}
As you can see above, in main i used statement obj= new A[20]; . As such the zero argument constructor gets called. What i want is that this statement cause one argument constructor to get called. How is it possible ??
ThankX.
Bye Bye
|
|
|
|
|
You can't. What would it call each one with?
Software is everything. It also sucks. Charles Fishman [^]
Awasu 1.0.2 (beta)[^]: A free RSS reader with support for Code Project.
|
|
|
|
|
Technically it's not possible, but you can certainly work around it. The easiest way is to get rid of your default constructor and give your other constructor a default value for its parameter:
A(int val = 17) { ... }
You can also go with more complex solutions, such as global or static member variables which you initialize before creating the array, and then perhaps increment inside the constructor as each element is created.
No matter what you do, all elements of the array will call the same constructor. There's no way out of it.
Regards,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Good people,
Is there any System.XML – alike class library for Visual C++ 6.0 ?
Thanks,
Serge
|
|
|
|
|
|
I use XML4C[^] - it's fast, free and open source!
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hello friends,
I am using a TVisualObject class given by Zoran M. Todorovic
I am able to split and place the tabs but one of the splitted window is occupying the entire space.I tried with changing the parametrew of CSize fn but its not working.i have attached the piece of code.Please suggest me to resize the window.
TVisualObject *pSplitter = new TVisualObject(1,"", 2, 1, pContext);
TVisualObject *pView1 = new TVisualObject(2,0,0,pContext, RUNTIME_CLASS(CDummyEdit), CSize(0,880));
TVisualObject *pView12 = new TVisualObject(13,0,0,1,2,pContext);
TVisualObject *pw12 = new TVisualObject(14,0,0,pContext,RUNTIME_CLASS(CDummyEdit),CSize(330,30));
TVisualObject *pw22 = new TVisualObject(15,0,1,pContext,RUNTIME_CLASS(CDummyEdit),CSize(0,80));
TVisualObject *pViewtab1 = new TVisualObject(3,1,0,pContext,RUNTIME_CLASS(TTabWnd),CSize(770,660));
TVisualObject *pTabView1 = new TVisualObject(4,"Log",pContext,RUNTIME_CLASS(CDummyEdit));
TVisualObject *pTabView2 = new TVisualObject(5,"Summary", pContext,RUNTIME_CLASS(CDummyTree));
//pTabView2->SetIcon(IDR_FINALTYPE);
m_Framework.Add(pSplitter);
m_Framework.Add(pSplitter, pView12);
m_Framework.Add(pView12,pw12);
m_Framework.Add(pView12,pw22);
m_Framework.Add(pSplitter, pViewtab1);
m_Framework.Add(pViewtab1,pTabView1);
m_Framework.Add(pViewtab1,pTabView2);
m_Framework.Create(this);
TVisualFrameworkIterator it(m_Framework);
while (!it.End()) {
TVisualObject *pObject = it.Get();
it++;
}
m_Framework.SetActivePane(pView12);
return TRUE;
|
|
|
|
|
Hi guys,
first of all, I'd like to say hi. It is my first time here.
I am having a task to write a program on MS V++ to open/close/query some information about hardware drivers from registry.
I have managed to find appropriate functions that could come in handy. RegOpenkey();
RegCloseKey();
etc..
My question is regarding to RegOpenKey() specifically.
From MSDN, RegOpenKey is defined as
LONG RegOpenkey(
HKEY hKey,
LPCTSTR lpSubKey,
PHKEY phkResult
);
I am trying open a subkey in a location such as HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Enum\PCMCIA\WLANCARD\1
I am wondering, if it is allowed to directly open the bottom subkey (\1) of this registry directory string, done as below.
HEKY hKey;
if (RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Enum\PCMCIA\WLANCARD\1", &hKey) == ERROR_SUCCESS);
MessageBox("The registry is open successfullly");
I don't seem to get correct response with the code
Thanks alot
|
|
|
|
|
if (RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Enum\PCMCIA\WLANCARD\1", &hKey) == ERROR_SUCCESS);
I hope there is a subkey by that name ..
secondly
change "\" to "\\" ..it will be
HEKY hKey;
if (RegOpenKey(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Enum\\PCMCIA\WLANCARD\\1", &hKey) == ERROR_SUCCESS);
|
|
|
|
|
Do not directly to the registry: there are several undocumented issues. rely on the setupapi described in details in DDK and SDK.
Here a short list of most important API:
SetupDiGetClassDevs opens a list of specific devices
SetupDiEnumDeviceInfo enumerates a kind of devices of specific type.
SetupDiGetDeviceInterfaceDetail gest the interface in order to open the handle for a specific device
and so on...
Regards
|
|
|
|
|
I use following code to hook other program's MOUSE message:
m_hHook=SetWindowsHookEx(WH_MOUSE,HookProc,AfxGetInstanceHandle(),dwReturn);<br />
the var m_hHook is defined for record the MOUSE HOOK,and these code whin a dll program.dwReturn was a var for a Dlg based program's thread ID.
when I debug it,I found that it it can set hook to the Dlg based program.but the process HookProc was never be called.
is there some error in my code?But my code just simple as above.
And the HookProc as follow:
<br />
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam )<br />
{<br />
return CallNextHookEx(m_hHook,nCode,wParam,lParam);<br />
}<br />
In my opinion,everything is OK!
But when I click my mouse in the DLG based program,the process HookProc had never been execute!
IS there somethingwrong?
Don't look at me in that way!
|
|
|
|
|
If you use global hook you should assure that the hookproc is in a dll module,
make sure that the instance is your dll module instance,and the last parameter must be 0
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
I am sure that the process HookProc is in a dll module.And the instance is the dll module instance.And I only want hook a dlg based program not global.So I think the 4th paramter is the Thread ID of the Dlg based program.
All of these parameters are checked correct.
By the way,If I make the 4th parameter to 0,the HookProc will be called when the mouse message was occured.And everything is OK!
But I only want to Hook a special Program.
How can I do?
thank you for help me!
Don't look at me in that way!
|
|
|
|
|
if you want install a local hook,the instance parameter should be NULL and the last parameter is the ID of your thread
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
How can I prevent the entire app directory from changing at the start of my program when someone double clicks the related file extention from windows explorer.. I'm not using the doc class. How can I prevent this b/c Its awfully ANNOYING!
-Steven
CPACodeProjectAddict
By reading this message you are held fully responsible for any of the mispelln's or grammer, issues, found on, codeproject.com.
For those who were wondering, actual (Linux) Penguins were harmed in creating this message.
|
|
|
|
|
I need to transmit the pointer of the CDialog to the parent > I am not able to set a member of the
parent because it doesnt fit with my scheme. So can I do this?
m_pParent->SendMessage(UDM_SOMETHING, this, ndummy)
?
Thanks
|
|
|
|
|
One solution is GetParent(). Another solution is AfxGetMainWnd().
Kuphryn
|
|
|
|
|
Cant do those. I am unable to include my view.h file into the cdialog.h file due to deeply entrenched circular includes...
So is SendMessage a bad idea?
|
|
|
|
|
nss wrote:
I am unable to include my view.h file into the cdialog.h file due to deeply entrenched circular includes...
But you should be able to include it in the cpp file, and just forward declare the class in the header file.
Anyway, SendMessage will work (although it is not really necessary here). You can do something like:
GetParent()->SendMessage( dlgPointerMessage, reinterpret_cast<wparam>( this ) );
And in the parent message map:
ON_MESSAGE( dlgPointerMessage, OnDlgPointerMessage )
LRESULT OnDlgPointerMessage(WPARAM wParam, LPARAM lParam)
{
CDlg* pDlg = reinterpret_cast<CDlg*>( wParam );
ASSERT_VALID( pDlg );
// Do something
return 0;
}
Dave
http://www.cloudsofheaven.org
|
|
|
|
|