|
I can't remember how to get a Program to play a sound, It was like playSound("ss.wav.") somthing like that .
One more thing, I need a way to change the titel(Caption) In a dialog window, in the program while it is running, how?
Thank you
|
|
|
|
|
>I can't remember how to get a Program to play a sound, It was like playSound("ss.wav.") somthing like that
PlaySound defined in Winmm.lib MMSystem.h
>One more thing, I need a way to change the titel(Caption) In a dialog >window, in the program while it is running, how?
SetWindowText
Michael
|
|
|
|
|
you are chasing PlaySound(LPCTSTR) ...
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
Thanks, that infomation was just what I needed...
|
|
|
|
|
Can you show me how to make the background transparant of a CDialog?
I preferably want code example!
|
|
|
|
|
check out some examples here at codeproject in the Windows 2000 section
regards
|
|
|
|
|
How VC processes the internal "divide" process ( I mean at the "bit" level)?
My project at hand is to simulate the "divide" process that VC does.
Is there any suggestions or articles about this topic?
Thanks,
Maer
|
|
|
|
|
If I use the function "LoadLibrary" to load a DLL, shall I release it after using?
How can I release it?
Thanks,
Maer
|
|
|
|
|
Yes, use FreeLibrary(HINST).
Unless you use it for the duration of your app. It will be released automatically when the process terminates.
Cheers
Steen.
"To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks Steen!
You have resolved my trouble, thanks pal!
Best regards,
Maer
|
|
|
|
|
|
A VB ActiveX control.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I'd like to show a unactivated dialog without disturbing the the user. So I want to move this dialog to a position where the neither the caret nor the mouse possesses. What should I do? Thanks a lot.
Tiny Flying Elephant
I love flying...
|
|
|
|
|
GetCaretPos will return caret position using client coordinates. You'll have to convert that into screen coordinates with ClientToScreen.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Suppose i know the name of a computer of my network...how do i find shared resources belonging that computer (like those which appears in Network neighborhood)?
I also mention that FindFirstFile("\\\\comp_name\\directory_name\\*.*",...) WORKS.IN COMMAND PROMPT DIR \\comp_name\\directory_name WORKS TOO.
But FindFirstFile("\\\\comp_name\\*.*",....) fails. IN COMMAND PROMPT dir \\comp_name FAILS TOO. IN EXCHANGE, NET VIEW \\comp_name RETURN EXACTLY WHAT I NEED.
My conclusion is FindFirstFile doesn't solve my problem. I tried WNet but i failed...
Thank you all.
|
|
|
|
|
Hi,
you can do it using this functions:
WNetOpenEnum
WNetEnumResource
You'll find all the information on MSDN.
I wrote a little program that walks through all machines in the local network looking for shared directories (it was 3 or 4 years ago), this is a snippet:
void CNetScanDlg::StartScan()
{
ULONG ulDataSize = 16000;
NETRESOURCE* pData = new NETRESOURCE[ulDataSize];
DWORD dwEntries = 0xFFFFFFFF;
OpenContainer(NULL);
delete [] pData;
}
BOOL CNetScanDlg::OpenContainer(NETRESOURCE* pNetRes)
{
//Datos necesarios para la API de NetWorking
ULONG ulDataSize = 16000;
NETRESOURCE* pData = new NETRESOURCE[ulDataSize];
DWORD dwEntries = 0xFFFFFFFF;
DWORD dwResult;
HANDLE handle;
//
dwResult = WNetOpenEnum(RESOURCE_GLOBALNET, RESOURCETYPE_ANY, 0, pNetRes, &handle);
if( dwResult == NO_ERROR )
{
dwResult = WNetEnumResource( handle, &dwEntries, pData, &ulDataSize);
if( dwResult == NO_ERROR )
{
for( DWORD i = 0; i < dwEntries; i++)
{
AddItem( pData[i] );
if(RESOURCEUSAGE_CONTAINER == (pData[i].dwUsage & RESOURCEUSAGE_CONTAINER))
{
OpenContainer( &pData[i] ); //Recursividad
}
}
}
}
delete [] pData;
return FALSE;
}
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
this one could be helpful too:
BOOL CNetScanDlg::AddItem(NETRESOURCE NetRes)
{
// CSADDR_INFO AddrInfo[100];
// DWORD dwSize = sizeof(CSADDR_INFO)*100;
// HOSTENT hostent;
CString strTemp;
switch( NetRes.dwDisplayType )
{
case RESOURCEDISPLAYTYPE_ROOT:
case RESOURCEDISPLAYTYPE_NETWORK:
{
m_htiNetwork = m_NetTree.InsertItem( NetRes.lpRemoteName, 1, 1, TVI_ROOT );
} break;
case RESOURCEDISPLAYTYPE_DOMAIN:
{
m_htiDomain = m_NetTree.InsertItem( NetRes.lpRemoteName, 0, 0, m_htiNetwork );
} break;
case RESOURCEDISPLAYTYPE_SERVER:
{
m_htiServer = m_NetTree.InsertItem( NetRes.lpRemoteName, 3, 3, m_htiDomain );
//int iGetResult =
/*
hostent = gethostbyname(NetRes.lpRemoteName);
if( iGetResult == ERROR_INSUFFICIENT_BUFFER )
m_NetTree.InsertItem("Error!", 4, 4, m_htiServer);
*/
//Incremento el numero de maquinas y actualizo la pantalla
m_nMachines++;
strTemp.Format("%d", m_nMachines);
SetDlgItemText(IDC_STATIC_MAQUINAS, strTemp);
//
} break;
case RESOURCEDISPLAYTYPE_GENERIC:
case RESOURCEDISPLAYTYPE_SHARE:
{
//Intento listar los archivos
CFileFind FileFind;
CString strPath(NetRes.lpRemoteName);
strPath += "\\*.*";
BOOL bResult = FileFind.FindFile(strPath, 0);
//
if( bResult ) //Si pude acceder a los archivos
{
m_NetTree.InsertItem( NetRes.lpRemoteName, 4, 4, m_htiServer );
//Incremento el nro de dir. habilitados y actualizo la pantalla
m_nDirHabilitados++;
strTemp.Format("%d", m_nDirHabilitados);
SetDlgItemText( IDC_STATIC_DIR_HABILITADOS, strTemp );
}
else //No pude acceder a ese SharePoint
{
m_NetTree.InsertItem( NetRes.lpRemoteName, 2, 2, m_htiServer );
//Incremento el nro de dir. Deshabilitados y actualizo la pantalla
m_nDirDeshabilitados++;
strTemp.Format("%d", m_nDirDeshabilitados);
SetDlgItemText( IDC_STATIC_DIR_DESHABILITADOS, strTemp );
//
}
//Incremento el numero de directorios y actualizo la pantalla
m_nDirectorios++;
strTemp.Format("%d", m_nDirectorios);
SetDlgItemText(IDC_STATIC_DIRECTORIOS, strTemp);
//
} break;
default: return FALSE;
}
m_NetTree.Invalidate();
return TRUE;
}
Anybody knows how to paste a code snippet into the forum with the original formatting (like tabs) ?
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Hi,
I wrote a small dll which should be the link between two application (allow communication between them). Each application can use the dll, but the data is not shared. I had a look at the article "How to share a data segment in a DLL" by Phil McGahan to implement a shared data segment.
Unfortunately this didn't work. Also the compiler always says:
LINK : warning LNK4039: section "SHARED" specified with /SECTION option does not exist
My dll looks basically like this:
#pragma data_seg("SHARED")
int counter;
#pragma data_seg()
#pragma comment(linker, "/section:SHARED,RWS")
extern "C" __declspec(dllexport) void test()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
counter++;
CString tmp;
tmp.Format("Counter=%i",counter);
AfxMessageBox(tmp,MB_OK|MB_ICONSTOP|MB_APPLMODAL);
}
What am I doing wrong
Can someone help
Thanks
|
|
|
|
|
You have to initialize counter (add the underlined part below):
#pragma data_seg("SHARED") <br />
int counter = 0;<br />
#pragma data_seg()
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Sounds too easy... but is working!!
Thanks
|
|
|
|
|
I have a listview on a dialog, and I want to set a dialog variable, when the user clicks a column header (which sorts the list view on that column, and I want to save which column and the sort order in that variable). Problem is, I searched all over MSDN, and I can't find a "user clicked listview X" Message Map from the main dialog (so that when the user clicks a column header, the main dialog then goes to the listview (a derived lv class which has a function to return column number and sort order) and gets the column number and sort order. Though there are ways I could work around this, it would be the cleanest implementation possible. Anyone have any ideas, or if there is an "list view header clicked" message map for the dialog?
|
|
|
|
|
Notification messages are sent to a control's parent. That means that header notifications are sent to the list control, not your dialog. You'll need to write a CListCtrl-derived class and use that in your dialog. The list can then either handle the sorting or send a private message (such as WM_APP) to the dialog to make the dialog do the sorting.
--Mike--
http://home.inreach.com/mdunn/
"....." -- Silent Bob
your with and
|
|
|
|
|
Hi all,
I'm writing simple ActiveX with MFC ActiveX Wizard ...
I have problem in my properties ...
I add new property: Disable(external name and BOOL m_disable member variable and void OnDisableChanged() notification function).
I add Checkbox to my property page for changing Disable property ...
I wanna add member variable for the Checkbox, but i can't see my property name in 'Optional property name' section in Add Member Variable dialog !!!
How can i solve it ?
In last, what is 'Optional property name' performance ?
Help me, plz ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
I writed ATL COM DLL via AppWizard and added to it ATL class "AtlObj".
after I imported function from Extention DLL that I created before. so:
------------------------------------------------------------
extern "C" __declspec(dllimport) void ShowDialog();
STDMETHODIMP CAtlObj::show()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState())
AfxMessageBox(".....");
ShowDialog();
return S_OK;
}
-----------------------------------------------------------
The problem : When I run it by client program (exe) the atl it works !
but the imported function (ShowDialog) dont performed. WHY ????????
|
|
|
|
|
I didn't answer yesterday because I'm not really knowledgable with regard to dll's in general. But have you tried putting in a breakpoint to see what happens if you trace into your ShowDialog function ?
Christian
As I learn the innermost secrets of the around me, they reward me in many ways to keep quiet.
Men with pierced ears are better prepared for marriage. They've experienced pain and bought Jewellery.
|
|
|
|