|
Does anyone know how to fix the bars of a CSplitterWnd bar so the user cannot resize them? I can't find any info in the MSDN, CP, or CodeGuru. Thanks for any help.
Mark
Sonork ID 100.10778:Waxy
------------------------------------------------
I am not discouraged because every wrong attempt discarded is another step forward
-- Thomas Edison --
|
|
|
|
|
1)
Use ClassWizard to create a new class named CMySplitterWnd of class type "generic CWnd" and change the references to CWnd in the class declaration and BEGIN_MESSAGE_MAP macro to CSplitterWnd.
2)
Using ClassWizard, create message handlers for WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_MOUSEMOVE. Bypass the CSplitterWnd functionality in each of these overrides by calling the corresponding CWnd handlers. The following example illustrates the WM_LBUTTONDOWN handler:
void CMySplitterWnd::OnLButtonDown(UINT nFlags, Cpoint point)
{
CWnd::OnLButtonDown(nFlags, point);
}
3)
Change any embedded CSplitterWnd members of your frame class to type CMySplitterWnd.
4)
Remove any menu items that generate a ID_WINDOW_SPLIT command (such as the "Split" item on the VIEWEX sample's "Window" menu). This prevents CView::OnSplitCmd() from being called.
By the way, this is "Copy-Paste" from the MSDN.
--BlackSmith--
|
|
|
|
|
I guess it all depends what you're searching for. "Tracking" was the keyword I should've searched for. It worked like a charm. I also over-rode the OnMouseMove message so the cursor doesn't change to a resize cursor.
Thanks for the help!!
Mark
Sonork ID 100.10778:Waxy
------------------------------------------------
I am not discouraged because every wrong attempt discarded is another step forward
-- Thomas Edison --
|
|
|
|
|
I'm developing serv-cli game
( using CSocket, negotiating with Send()/Receive() )
I also have these classes:
[1]
class CMsg{
public:
virtual void method() = 0;
};
[2]
class CMsgDerive : public CMsg{
public:
virtual void method()
{
AfxMessageBox("Moo");
}
};
both sides familiar with this classes. Next, I send the data to the server:
clientSocket.Send((void*)&CMsgDerive(), sizeof(CMsgDerive));
I receive the data at the server:
void CServrSocket::OnReceive(int err)
{
TCHAR lpBuffer[1024]; //The data is much smaller
Receive(lpBuffer, sizeof(lpBuffer));
CMsg *pMsg = (CMsg*)lpBuffer;
pMsg->method(); //Here I get "unhandable exception" error, WHY???
}
Thank you all!
--BlackSmith--
|
|
|
|
|
I think the server try to call CMsg::method() which is abstract. There is AFAIK no way the server knows that it's actually a CMsgDerive class that you are sending...
Virtual functions are great, but I have seen a lot of errors when used like you do...
Have you tried CMsg *pMsg = (CMsgDerive*)lpBuffer; instead, or even CMsgDerive *pMsg = (CMsgDerive*)lpBuffer;?
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
It is crashing because the virtual function pointers are not the same on the client and the server. Your current approach is really bad, try looking through the source of some open source client/server network games for some better ideas.
Chris Hafey
|
|
|
|
|
I am developing a piece of software for my Diploma Thesis Project. When I created the framework with AppWizard, I was asked what language I wanted my resources in. The only choice was English (U.S.). But I run a Greek version of Windows 98 and, after all, Greek is my mother tongue. How can I have an application with all resources in Greek?
George Metaxas
Student of Electrical & Computer Engineering
Aristotle University of Thessaloniki, Greece
|
|
|
|
|
I would like to check the status of the SQL Server Service from within a C++ app.
My Installshield app installs MSDE if needed so I can assume SQL Server is a least present on the PC.
The functions I am looking for:
- See if it is installed - I currently do this via CurrentVersion item under the Software\Microsoft\MSSQLServer\MSSQLServer\CurrentVersion key
- See if it is running
- See if it is configured to start automattically at boot time
I would also like the ability to set up SQL Server to run and start at boot time from my app as well.
The difficult part is that I am looking to do this under Windows 98, ME, NT, 2000 and XP. I know there are functions in NT, 2000 and XP that I can use but I need all OS's.
Thanks
AW
|
|
|
|
|
You need to Cheek the status Service.
Use OpenService and then use QueryServiceStatus for check the status of service....
Best Regards....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Carlos:
It appears OpenService and QueryServiceStatus do not run under Win 98.
AW
|
|
|
|
|
|
Look on MSDN for "Windows Address Book"
Michael
|
|
|
|
|
|
here's how i do it with std::wstring:
void replace_all(wstring& target, const wstring& to_find, const wstring& replacement )
{
if (to_find.empty())
return;
size_t replace_inc = replacement.length();
for (size_t loc = target.find( to_find );
loc != wstring::npos;
loc = target.find( to_find, loc + replace_inc ) )
{
target.replace( loc, to_find.length(), replacement );
}
}
-c
Smaller Animals Software, Inc.
|
|
|
|
|
If you don't mind a little unsupported code you can use CString from WTL.
|
|
|
|
|
I want to catch WM_CLOSE from WinAmp and then my app will do something.
Is it possible to catch a windows message in my app that is in WinAmp??
Win32 API programming code example if you want to give code example
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
You need a Hook to do that. See SetWindowsHookEx
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
The Winamp sample from their site subclasses the Winamp main window. Just follow that and you'll see all messages first, so you can act on WM_CLOSE (or anything else you want) before Winamp sees it.
--Mike--
http://home.inreach.com/mdunn/
While I can't be correct on all matters, I can make the reassuring claim that where I am inaccurate, I am at least definitively inaccurate.
your with and
Sonork - 100.10414 AcidHelm
Test out a prerelease build of my Hotfix Checker v2.0! (133K)
|
|
|
|
|
I'm not 100% sure this is the right place to post this problem, as it is not programmatic strictly speaking, but anyway...
I've got a program that installs some modem .inf drivers, then creates a dial-up entry and uses it via RasDial . Everything's pretty straightforward and the program runs fine in Win9x. In Windows 2000, however, weird things happen. The program seemed to erratically work or fail to work depending on the drivers I'd previously installed. Finally I isolated the cause of the problem, and it seems to be that, no matter which driver I instruct the dial-up entry to use (with RasSetEntryProperties ), it is the last installed driver which is used. I can check this by enabling logs for the drivers and verifiyng it is actually the last installed modem the one that gets accessed instead of the modem the dial-up entry is set for.
What's even more strange, I'm able to reproduce this exact behavior without using my program, i.e. by creating manually the dial-up entries and double-clicking them. This really strikes me, since it seems too gross a bug to have went unnoticed for so long. Checked MSDN, the web and the Usenet and I've found nothing related to this problem, except the article Q162219, which anyway is about NT4.0 and not 2000.
This is driving me nuts, any idea, suggestion, whatever, will get my eternal gratitude .
Machine is Win2000 spanish version, SP2. Plenty of resources, freshly installed.
If anyone wants, I would gladly send him/her the offending .inf drivers, though I don't think these particular drivers make any difference (who knows, anyway).
Thanks for your help, regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Does anyone know how to do a screen grab into a DIB from a CView derived window. I actually do the rendering in the window using OpenGL and I need to display the screen grab of the window in a thmubnail. everything is set up, now I need to get that DIB from the window.
Oh yeah, the other thing is that not all of the windows will be visible, but I still need to grab of the screen as it would appear if it were on top...
can anyone help?
|
|
|
|
|
I want to create an Excel file.
so I use :
hFile=::CreateFile("E:\\my.xls", GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
but this file is 0 KB ,
In fact ,EXCEL create a new file is 11kb.
I think ,this file don't contain excel format .
Can you help me ?thank you!
|
|
|
|
|
the file u created is an empty file. .xls if a file format and u need to create ur file in that file format. just by naming a file with .xls extension u cant get an excel sheet. so search creating a file in excel file format
Ganesh Ramaswamy
|
|
|
|
|
If you can ensure excel will be installed on the machine(s) where your program will run, you can use Excel's COM interface to create a new worksheet: (example for Excel 97)
import interfaces (adjust to install path for office)
#import "C:\Program Files\Microsoft Office\Office\MSO97.DLL"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBEEXT1.OLB"
#import "C:\Program Files\Microsoft Office\Office\EXCEL8.OLB" \
rename("DialogBox","_DialogBox") \
rename("RGB","_RGB") \
exclude("IFont","IPicture")
using namespace Excel;
launch Excel, create new workbook
_ApplicationPtr pApp(__uuidof(Application));
pApp->Workbooks->Add();
display to user
pApp->PutVisible(TRUE);
For more information on manipulating Excel via COM, see the MSDN documentation. For more on using the Excel COM interface from Visual C++, see Igor Tkachev's article Using MS Office in an MFC Application.
|
|
|
|
|
Okay it's time to make my Cuestion....
Any body Know which is the service that manage the Shared Directorys????
I have a service that read a shared directory, When the server starts the service can't read the shared directoy. I need to make my service depending of that service...
Thanks....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
I think it's the 'Server' service
|
|
|
|