|
Hi Mark,
here is my code snippet and the error I get after the test run of SetWindowText.
As always - my text is not showing the derefference "->" correctly, but it is there!
m_hWnd = capCreateCaptureWindow(_T("Preview - AVI frame "),
WS_CHILD|WS_CLIPSIBLINGS | WS_CAPTION | WS_VISIBLE | WS_MAXIMIZE |WS_MAXIMIZEBOX |WS_MINIMIZEBOX , x, y, 100,200,
pParentWnd?pParentWnd->GetSafeHwnd():NULL, 0xffff);
VERIFY(m_hWnd);
m_hWnd->SetWindowText(_T("Ready for AVI frame "));
error C2039: 'SetWindowTextA' : is not a member of 'HWND__'
|
|
|
|
|
m_hWnd is an HWND, not a CWnd*.
You can call the Win32 API directly:
::SetWindowText(m_hWnd, _T("Ready for AVI frame "));
or wrap the HWND in a CWnd object and use CWnd methods:
CWnd vcapwnd;
vcapwnd.Attach(m_hWnd);
vcapwnd.SetWindowText(_T("Ready for AVI frame "));
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks Mark, appreciate you putting up with my stupid mistakes.
Vaclav
|
|
|
|
|
The following string encoded in UTF8
"s in €" appears in ascii as "s in €"
after a call to MutiByteToWideChar
int nSize = MultiByteToWideChar(CP_UTF8,0,pstrValue,-1,NULL,0);
if ( nSize == 0 )
return;
WCHAR * pBuffer= new WCHAR[nSize];
MultiByteToWideChar(CP_UTF8,0,pstrValue,-1,pBuffer,nSize);
unfortunately instead of the Euro sign, I get the character #26
Any idea?
Thanks
|
|
|
|
|
Do you check the utf8 values in pstrValue are correct?
Correct utf8 value for Euro sign is "0xe2, 0x82, 0xac".
Also, if you check the pBuffer using C runtime function like printf, you should set locale properly before calling printf through setlocale function.
I test your code but it runs correctly.
|
|
|
|
|
Hello !
I've written a custom dll to allow users to launch a little proggy that can unlock their password.
This is working pretty good except when I want to log remotely on a workstation where the gina.dll has been installed with Terminal Services.
Does anyone know what informations I have to initialize so that it'll work or point me to an example ?
I'm clueless on what to do...
Thanks a lot !
Narf
|
|
|
|
|
I switched to using WLX_VERSION_1_4 and I tried to get a pointer on the WlxQueryTerminalServicesData and WlxQueryTsLogonCredentials functions but GetProcAddress tells me these 2 doesn't exist in msgina.dll.
They don't have any aliases when I look at them through the Dependency Walker.
Anyone ?
|
|
|
|
|
Hello all,
I am having some issues with a few of my projects at work here. I have one which is a service using the afx dll and one which is a mfc project and also includes the afx dll. The reason I am pointing out that the afx dll is included is that I have a project which does not use stdafx.dll or #define _AFXDLL and it still compiles fine.
The weird thing is it worked on Wednesday before the Thanksgiving vacation. I even have an installer that I had created. When I got back to work on Monday, it gives me these 13 errors:
from zmouse.h:
Error 1 error C2146: syntax error : missing ';' before identifier 'HwndMSWheel'
Error 2 error C2433: 'HWND' : 'inline' not permitted on data declarations
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 4 error C2065: 'PUINT' : undeclared identifier
Error 5 error C2146: syntax error : missing ')' before identifier 'puiMsh_MsgMouseWheel'
Error 6 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 7 error C2059: syntax error : ')'
Error 8 error C2143: syntax error : missing ';' before '{'
Error 9 error C2447: '{' : missing function header (old-style formal list?)
from prsht.h:
Error 10 error C2065: 'CALLBACK' : undeclared identifier
Error 11 error C2065: 'LPFNPSPCALLBACKA' : undeclared identifier
Error 12 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Error 13 fatal error C1903: unable to recover from previous error(s); stopping compilation
I even rebuilt my service from scratch, just copy and pasting code into the new project from my old project. That did not work.
Like I said before, it worked on Wednesday, I did not touch it for four days, and on Monday I tried to compile it and it would not work. It has the same exact errors no matter which settings I choose in my project settings, or which order my includes are in. I am really at a loss here, and was wondering if anyone else has ran across this.
I redownloaded and reinstalled the Windows SDK. No worky.
I have tried to research this extensively but the only advice I see is to include windows.h before zmouse. I am not actively including zmouse, however, so I am not sure why it is erroring.
Here is my stdafx.h:
#pragma once
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
#define _AFXDLL
#include afxsock.h
#include stdio.h
#include tchar.h
#include winsock2.h
#include ws2tcpip.h
It is a pretty basic project which just uses a 3rd party SDK to connect to and control a telephone PBX. I need the socket classes in there to communicate with one of the companies servers.
Here is the stdafx.h from my other project (uses a SDK to create a video viewer that connects to a DVR out in the field). This project was one I inherited from another developer, then modified it when the clients wanted something added. This one compiled fine as well, until this Thanksgiving weekend.
#pragma once
#define WM_MYTHREADMESSAGE (WM_USER+1)
#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
#ifndef WINVER // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
#define _AFX_ALL_WARNINGS
#include afxwin.h
#include afxext.h
#include afxdisp.h
#ifndef _AFX_NO_OLE_SUPPORT
#include afxdtctl.h
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include afxcmn.h
#endif // _AFX_NO_AFXCMN_SUPPORT
I would greatly appreciate any help on this and any more information you may need I will be glad to post.
I am using Visual Studio 2008
Windows XP Service pack 3
.NET Framework 3.5
Windows SDK 2008 for XP SP 2
The only thing I can think is that this weekend my computer downloaded an update when I was sleeping... but I have also researched that extensively and could find nothing on it.
EDIT: I had to take the greater and less than's off my includes so they would show. That is *NOT* a syntax error.
|
|
|
|
|
No one has ran across this before or has any advice?
I have tried all the settings in my linker, and C++ tabs in my project properties, I have tried rearranging the order of my includes (read this from another site) as well as redownloading and reinstalling the Windows SDK. I am about to reinstall Visual Studio 2008.
Any help at all would be appreciated!
|
|
|
|
|
I have a problem where I wish to receive broadcast UDP using call recvfrom, it just sits on the call waiting, although the packets are arriving as I can see in Wireshark.
In the scenario, I have a virtual machine which provides the broadcast packets on UDP port 3000, which are being received on the host machine through the loopback adapter. As a starting point, I’ve used the example code from the MSDN Library entry for recvfrom and changed the port value to 3000, and used setsockopt to set SO_BROADCAST to true.
Using netstat, I can see an active connection on my process for 0.0.0.0:3000.
Where am I going wrong?
Any help appreciated
david
EDIT: im kind of thinking its something to do with it coming from a virtual machine over a loopback adapter???
And by the way, its on Vista64 using Visual Studio 2005
modified on Wednesday, December 3, 2008 11:35 AM
|
|
|
|
|
seadsl wrote: im kind of thinking its something to do with it coming from a virtual machine over a loopback adapter???
Did you attempt to prove that theory by executing the systems without using the virtual machine?
led mike
|
|
|
|
|
Unfortunately its not an option, I must use the UDP packets from the virtual machine. I dont have any other broadcast source.
|
|
|
|
|
seadsl wrote: I dont have any other broadcast source.
Umm, then you make one so you can test the theory.
led mike
|
|
|
|
|
Its fixed now.
For anyone else with the same problem:
In Windows Vista, you cant bind a socket to 0.0.0.0 to receive all broadcasts.
If you are receiving from a multicast address, you need to set the socket options to indicate the multicast group (address) you need to subscribe to, the source address, and the local interface:
imr.imr_multiaddr.s_addr = inet_addr("224.x.x.x");
imr.imr_sourceaddr.s_addr = inet_addr("s.s.s.s");
imr.imr_interface.s_addr = inet_addr("192.168.1.1");
retvalset = setsockopt(
RecvSocket,
IPPROTO_IP,
IP_ADD_SOURCE_MEMBERSHIP,
(char*)&imr,
sizeof(imr));
|
|
|
|
|
Hello,
I've searched very much to find an example of using keyboardmanger() class.
Could you lead me and give me an example of using last key was pressed.
Please help me as soon as possible.
Thanks
hnaghdali
|
|
|
|
|
what is this 'keyboardmanger() class' supposed to do?
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
|
hnaghdali wrote: Could you lead me and give me an example of using last key was pressed.
Ofcourse. Why not! Basically you have to hook the keyboard. Check these articles - Hooking the Keyboard[^] and An All-Purpose Keyboard Hooker.[^].
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
I have a Property Sheet and I need to disable the close button, the red "X" button that appears on the right top of the sheet. What is the procedure for disabling it?
|
|
|
|
|
CMenu* pSysMenu = GetSystemMenu( FALSE );
pSysMenu->DeleteMenu( SC_CLOSE, MF_BYCOMMAND );
|
|
|
|
|
Thanks
|
|
|
|
|
Hi,
I would like to know if there is a better way of writing a particular pattern of the code as mentioned below. I have been encountering this type quite frequently and do not like the way it is implemented. The code piece is as follows
class Address
{
public:
Address():m_address("")
{}
Address(const CString& addr) : m_address(addr)
{}
CString GetAddress()------------------ (1)
{
return m_address;
}
CString GetAddress() const ------------------ (1a)
{
return m_address;
}
const CString& GetAddress() const -----(2)
{
return m_address;
}
private:
CString m_address;
};
Now somewhere in main method
Address addr("Living somewhere on Earth");
further down a call is made into a third party library which only takes char* and has a method like
void FormatAddress(char* address); -------(3)
Now if I make a call to this method, I must do this
FormatAddress(const_cast<char*>(addr.GetAddress().GetString()); -------------(4)
So my query is whether the whole piece of code is correct, sure it does compile and gives the result as expected
but I am looking to improve my programming skills and want to write a better and cleaner code.
Out of the methods 1 and 1a which is more correct? Does it makes sense to make the m_address variable as mutable.
Thanks and Regards
|
|
|
|
|
LPCTSTR GetAddress() const
{
return m_address;
}
as the only access function
when void FormatAddress(...) is NOT changing the input paramters
Greetings from Germany
|
|
|
|
|
Can any one direct me to develop a generic report writer with VC++ 6. What I need is I have some data in some text files and I want to display it in some report-viewer-style. Please don't ask me to dump it into some standard database and use a third-party tool to view it.
There are some utilities provided in this site itself but is not up-to-the mark.
|
|
|
|
|
Member 275519 wrote: I have some data in some text files and I want to display it in some report-viewer-style.
Can't you use SDI/MDI with doc/view architecture...?
|
|
|
|