|
There is a great article located here:
http://codeguru.earthweb.com/controls/multiline_listbox.shtml
It has a simple CListBox with variable row height. Is there
any way of making an arbitrary row from that list viewable,
but unselectable??
Please, please, please, any response any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
Yes, you have to trap the incoming event, check the row and reset the current row if the one selected is an unselectable row.
Something like this should do the trick. You will need to decide what item should be selected if the one clicked is unselectable. You could just set it to the last one.
void CSelectList::OnClick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
if (IsUnselectable(pNMLIstView->iItem)
{
SetHtItem(iSomeotheritem)
}
*pResult = 0;
}
Ho[e this is of help,
Bill
|
|
|
|
|
You must do it in the function named OnItemSelChanging(NM_,
LRESULT *pResult), also, this is a member function of CListCtrl.
In that function, you should decide if the current item is the one you want to unselecting,and set the *pResult to 1.
///
{
if(XXXX)
{
*pResult = 1;
}
}
|
|
|
|
|
Okay, so I've got an IActiveDesktop instance, but whenever I call SetWallpaper, it sets a blank desktop instead of the image. But it's also returning S_OK. Any ideas...
Thanks,
- Mike
|
|
|
|
|
I just realize that maybe it's related to the Unicode string that SetWallpaper requires? I'm taking a LPSTR and casting it to a LPCWSTR. I can't figure out a way to test the casted string to see if it's right. How can I view a unicode string like that in something like a message box?
- Mike
|
|
|
|
|
You have to use a conversion routine to change from an LPSTR to a LPCWSTR see Technical Note 59 for more info
---
Blessed are those who can laugh at themselves, for they shall never cease to be amused
|
|
|
|
|
Hey, that fixed it! Thanks!
BTW, for anyone that wants to know, if you have a LPCSTR and want to create a LPCWSTR out of it, include afxpriv.h and do:
LPCWSTR x = A2CW(pszString);
There are other macros too, in case this isn't exactly what you're looking for.
- Mike
|
|
|
|
|
I am trying to execute some stored procedures that have parameters but I keep getting errors. Simple stored procedures with no parameters I have no problem with.
Here is my sample test code which keeps triggering user exceptions:
strProcedure = "Hojo_Test_Fun";
strQuote = strProcedure;
pCmd->CommandType = adCmdStoredProc;
pCmd->CommandText = _bstr_t(strQuote);
pCmd->Parameters->Append
(
pCmd->CreateParameter
(
_bstr_t("some_name"),
adChar,
adParamInput,
30,
_variant_t(_bstr_t("ALKFO"))
)
);
pBs = pCmd->Execute(&vNull,&vNull,adCmdUnknown);
What am I doing wrong? Help!
Hojo
|
|
|
|
|
I tend to leave the first parameter of CreateParameter as "" rather than passing some data in.
What is the error message you are getting and where is it occuring.
It might be useful if you could post the stored procedure too.
Below is the kind of code I use. I have a set of wrapper classes that I use, so this code isn't exactly what I use but covers everything I call and how I call it.
hr = m_pCommand->put_CommandText(_bstr_t("cti.CALLTRACK_ADD"));
m_pCommand->CommandType = adCmdStoredProc;
_ParameterPtr pParam;
variant_t vtCallID("CAllIDData");
pParam = m_pCommand->CreateParameter("", adChar, adParamInput, 64, vtCallID);
m_pCommand->Parameters->Append(pParam);
pParam->Value = vtCallID;
m_pCommand->Execute(NULL, NULL, adCmdStoredProc);
Michael
|
|
|
|
|
Send me your mail me direct and I'll send you a wrapper class and example.
Norm Almond
Chief Technical Architect
FS Walker Hughes Limited
|
|
|
|
|
I am working on a project that will recieve netmeeting calls. Upon connection it will open an audiostream, and then watch the state of the INmChannelAudio object. More precisely, the INmChannelAudio object is supposed to provide an automatic callback to the INmChannelAudioNotify class, which I have written according to the samples provided by microsoft. However, for some reason it never calls back that function. Also, when I manually try to check the state of the INmChannelAudio object via the calls GetState and IsIncoming, GetState returns NM_AUDIO_TRANSFERRING once the audio object has become active, unless it has been set to pause, in which case it returns NM_AUDIO_PAUSED. IsIncoming() always returns S_FALSE, even when there is audible data coming from the speakers.
So I am led o a couple of assumptions -- Either my code to check the state is wrong, or I am connected to the object wrong. I'm almost certain my code to check the state is correct, since it changes. I am not sure about IsIncoming though, because it always returns S_FALSE. the code I have been using is
HRESULT hr;
NM_AUDIO_STATE puState;
PUSER pUser = (PUSER) PUserLocal();
INmChannelAudio * pChannel = pUser->m_pChannelAudio;
pChannel->GetState(&puState);
hr = pChannel->IsIncoming();
However, no matter what, this code doesn't really matter. I am using it to debug. My main problem is the class CAudNotify which is the INmChannelAudioNotify class. As I said before, the INmChannelAudio class, which is predefined, is supposed to call back to my CAudNotify class once they are connected. Since it does not, I assume my connect code is flawed. Here is that code:
//Class declaration
class CAudNotify : public RefCount, public CNotify, public INmChannelAudioNotify
{
public:
CAudNotify();
~CAudNotify();
// INmChannelAudioNotify
HRESULT STDMETHODCALLTYPE NmUI(CONFN uNotify);
HRESULT STDMETHODCALLTYPE MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember * pMember);
HRESULT STDMETHODCALLTYPE StateChanged(NM_AUDIO_STATE uState);
HRESULT STDMETHODCALLTYPE PropertyChanged(DWORD dwReserved);
// ICNotify methods
HRESULT STDMETHODCALLTYPE Connect (IUnknown *pUnk);
HRESULT STDMETHODCALLTYPE Disconnect(void);
// IUnknown methods
ULONG STDMETHODCALLTYPE AddRef(void);
ULONG STDMETHODCALLTYPE Release(void);
HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppvObj);
};
//and class code
HRESULT HookAudio(INmChannel * pChannel)
{
HRESULT hr;
CAudNotify * pNotify;
ASSERT(NULL != pChannel);
if(NULL != g_pChannelAudio)
{
g_pChannelAudio->Release();
MessageBox(NULL,"HookAudio: replacing existing g_pChannelAudio","call",MB_OK);
}
if(NULL != g_pChannelAudio)
{
g_pNotifyAud->Disconnect();
g_pNotifyAud->Release();
}
hr = pChannel->QueryInterface(IID_INmChannelAudio, (void **)&g_pChannelAudio);
if (FAILED(hr))
{
MessageBox(NULL,"HookAudio: Unable to get Audio channel","call",MB_OK);
return hr;
}
pNotify = new CAudNotify();
if(NULL == pNotify)
{
hr = E_OUTOFMEMORY;
}
else
{
hr = pNotify->Connect(g_pChannelAudio);
if(FAILED(hr))
{
MessageBox(NULL,"CAudNotify Failed" ,"call",MB_OK);
pNotify->Release();
}
else
{
MessageBox(NULL,"Audio Connection point established successfully" ,"call",MB_OK);
g_pNotifyAud = pNotify;
}
}
if(FAILED(hr))
{
MessageBox(NULL,"Audio Connection point failed" ,"call",MB_OK);
g_pChannelAudio->Release();
g_pChannelAudio = NULL;
}
return hr;
}
HRESULT STDMETHODCALLTYPE CAudNotify::QueryInterface(REFIID riid, PVOID *ppvObject)
{
HRESULT hr = S_OK;
*ppvObject = NULL;
if (riid == IID_IUnknown)
{
*ppvObject = (IUnknown *)this;
MessageBox(NULL,"CAudNotify::QueryInterface(): Returning IUnknown.","call",MB_OK);
}
else if (riid == IID_INmChannelAudioNotify)
{
*ppvObject = (/*INmChannelAudioNotify*/PVOID *)this;
MessageBox(NULL,"CChannelAudioNotify::QueryInterface(): Returning INmChannelAudioNotify.","call",MB_OK);
}
else
{
hr = E_NOINTERFACE;
*ppvObject = NULL;
MessageBox(NULL,"CAudNotify::QueryInterface(): Called on unknown interface.","call",MB_OK);
}
if (S_OK == hr)
{
AddRef();
}
return hr;
}
HRESULT CAudNotify::Connect(IUnknown *pUnk)
{
MessageBox(NULL,"CAudNotify::Connect","call",MB_OK);
return CNotify::Connect(pUnk, IID_INmChannelAudioNotify, (IUnknown *)this);
}
HRESULT STDMETHODCALLTYPE CAudNotify::MemberChanged(NM_MEMBER_NOTIFY uNotify, INmMember *pMember)
{
MessageBox(NULL,"MemberChanged","caudnotify",MB_OK);
PUSER pUser = PUserFromINmMember(pMember);
if(NULL!=pUser) UpdateUserChannel(pUser, (INmChannel *) (CNotify::GetPunk()), uNotify);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudNotify::PropertyChanged(DWORD dwReserved)
{
MessageBox(NULL,"call to caudnotify::propertychanged","call",MB_OK);
return S_OK;
}
HRESULT STDMETHODCALLTYPE CAudNotify::StateChanged(NM_AUDIO_STATE uState)
{
//I believe this is where we'll check whether audio is incoming or outgoing and therefore whether to turn on PTT or off
MessageBox(NULL,"call to caudnotify::statechanged","call",MB_OK);
IID iid;
HRESULT hr;
INmChannelAudio *pAudioChannel;
hr = QueryInterface(iid,(void **)&pAudioChannel);
if (SUCCEEDED(hr))
if (uState == NM_AUDIO_TRANSFERRING){
MessageBox(NULL,"Transferring","duh",MB_OK);
if (pAudioChannel->IsIncoming()==S_OK){
PTTOn('A');
}
else{
PTTOn(0);
}
}
// }
return S_OK;
}
There are other bits and pieces of code in the class, but they probably have no connection.
So the problem is I don't even get that messagebox in ::MemberChanged, ::StateChanged, or ::PropertyChanged.
Please help!!
Thanks a million,
Aniel Sud
--UPDATE--
I found that the QueryInterface method is being called with several IIDs that I had not before heard of -- namely IID_IMarshall, IID_IStdMarshall, IID_IexternalConnection, and 0000001B-0000-0000-C000-000000000046. I did a search for IID_IMarshall, and came back with one newsletter that was very vague. But it did say something about requiring marshalling. What is marshalling? do I need it in this instance?
Thanks again for all the help!!
--UPDATE--
I have found out about marshalling, and I don't think I should need it in an app such as this. Moreover, I don't see anything about marshalling in the samples. Is it ok to just let these requests slide?
Thanks again!
Aniel
|
|
|
|
|
I am developing with Windows 2000 Visual C++ 6.0 SP5. I need to be able to send data over the internet to firmware connected to the internet with an always on connection. Do I use Winsock API to send the packets of TCP/IP structure?
|
|
|
|
|
Yup. You can use Winsock API for this. However, I would consider easier solutions (SOAP?).
I vote pro drink
|
|
|
|
|
Thanks for your help. What other solutions do you suggest other than SOAP?
|
|
|
|
|
Well, depends on your concrete situation. If your clients use firewalls (I guess they do), than you'd better stick with HTTP (with SOAP or without it - maybe plain HTTP POST). If they don't use firewalls, than you can use something like DCOM or CORBA.
I vote pro drink
|
|
|
|
|
Hello, the codegurus around the world.;)
If you can use HTTP, FTP or Gopher, WinInet API function is another option.
If you want to use your own Server throuth TCP/IP, WinSock (or CSocke...) is only choice.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
I'm trying to capture a screen from the windows media player. It appears that they use a directx overlay for the video (not completely sure). So, if you try to capture it through the normal GDI means, all you get is the black background.
There is at least one program available that can capture it through directx, but I am trying to figure out how it is done. Can anyone tell me how to get access to the directx surface to obtain the data? EnumSurfaces appears to work only inside the same process and inside the same directdraw object. Please help!
|
|
|
|
|
My application(.EXE) drops a buch of events into the event log for the network admin folks and other users.
In my MFC prject, I have an event message file <filename>.MC which is compiled separatedly using "mc" command line utility. After message compilation, <filename>.rc, <filename>.h and MSG00001.bin files are created by "mc". The problem is that I only know how to produce event message resource table for the evnt viewer using command line "rc"(produces <filaname>.res) and "link" step, which finally produces <filename>.dll(it will contain the table). To automate this process, I had to write a batch file, which executes all these utilites. This batch file is automatically executed in the post-build step - pretty cumbersome and boring, isn't it? This is the old Win32 way of doing things for the event viewer, and I don't particularly like it. I know that the message resource table can be easily contained within the same executable that runs my project, which will save the headache of managing two separate files, .EXE - the program, and .DLL - program's event message table.
Tried many things with .rc files and recourse.h - event viewer only recognizes messages from the .dll.
Does anyone know how to properly merge .rc and .res files within the same project to create one common resource table that will contain the prject's resources as well as its event message table.
Will be happy to digest any hints.
Thanks.
Kirill
|
|
|
|
|
Just put this line in the top of the project's .rc file...
1 11 msg00001.bin
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Help. I want to change the appearence of a check box control so that it looks flat, no background, no border, only the check appears.
The control will serve as a visual indicator and not accept input from user.
How can I do this or where should I look?
Thanks,
John
|
|
|
|
|
No background? You mean that there will be some other controls below and you want to see them?
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
I want the Check Box to have the same "grey" background as the Dialog which contains it -- i.e. no white background, no border around the check box.
I hope this won't be impossible or have to resort to display a bitmap.
Thanks.
Johnny
|
|
|
|
|
Derive your class from CWnd and call DrawFrameControl in OnPaint handler. DrawFrameControl can draw many UI elements, some combination of flags should give you just checkmark on standard background. No bitmap required.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
Just use a picture control with an icon - that way the background will be see-through. Then use ShowWindow(SW_SHOW / SW_HIDE) to show or hide the control.
--
Andrew.
|
|
|
|
|
Thanks.
I guess I was intimidated by using a graphic.
John
|
|
|
|
|