|
bRes = PlaySound( (LPCTSTR)SND_ALIAS_SYSTEMASTERISK, NULL, SND_ALIAS_ID | SND_NOSTOP | SND_ASYNC | SND_NOWAIT );
Works fine with all Windows platforms except Win ME. The crash only occurs when trying to play system sounds.
Is there something to do?
Thanks!
|
|
|
|
|
Hi All!
I have to write a client application which would use sockets to get data from partucular device via TCP\IP. Client code will reside in dll and should run under Windows 98 - XP. I think I can use WinSock 2.0 for this, but the problem is that my application should be easily ported to Linux later. Of course it cannot be just recompiled, but i have to acheive best compatibility possible to make my life more easy later when porting time comes. Unfortunately my knowledges regarding sockets are just theoretical. Could you please, suggest me what should be avoided to make WinSock 2.0 (or 1.1) based solution more or less portable to BSD based sockets solution. I understand that WinSock was written based on BSD sockets API but anyway, there should be something wrong Additionally, data sending, receiving, connection process will be run in separate threads, so some comments regarding portable notifications (or solutions to be notified) of task completion would be very helpful. If the topic is too large then could you please, point me to some Article which covers the problem?
Thanks in advance!
Best regards,
Dima
|
|
|
|
|
Short answer:
If you look at the winsock api reference most of the functions that start with a lower case letter are portable. The ones that start with and upper case letter are MS specific.
So, for example, you would use:
socket, accept, connect
as opposed to:
WSASocket, AcceptEx, ConnectEx
As for portable notifications ...
I find IOCP to be too usefull to ignore in the name of portability.
I would suggest this for windows.
There are number of good articles here on using IOCP.
For UNIX either mimic IOCP, use select, or roll you own.
In the end i would suggest you write a socket class that hides the OS specific issues.
Create one optimized for windows and another for unix, but both with the same public interface.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Does anyone have any idea of how to do what Windows Explorer does in the "Folders Options/View/Advanced Settings": Use radio buttons in a standard system treeview?
I checked out this article (XP theme aware TreeView control which supports checkbox and radio button nodes), but it's using .net and it seems to be using bitmap images (I could be wrong though). I just want to use Win32 APIs to do this. I think it should be possible because in the Platform SDK, it states that "When set to this style [TVS_CHECKBOXES], the control effectively uses DrawFrameControl to create and set a state image list containing two images"; however, I tried to imitate this to no avail. I tried using DrawFrameControl but it always draws the flat, non-themed styled control (all other controls in the window is correctly drawn with the XP theme looks).
Please help! Any advice is much appreciated!
Thanks.
Ken
|
|
|
|
|
Hi all,
I have written a DLL that is statically linked to the MFC and it #imports ADO just like this...
#pragma warning(push)<br />
#pragma warning( disable : 4146 ) // ADO compile warning cannot be avoided<br />
<br />
#import "c:\Program Files\Common Files\System\ADO\msadox.dll"<br />
<br />
#import "c:\Program Files\Common Files\System\ADO\msado15.dll" no_namespace rename("EOF","EndOfFile")<br />
<br />
#pragma warning( default : 4146 ) // Restore warnings for rest of application<br />
#pragma warning(pop)
My DLL has a global variable defined as :
_ConnectionPtr pConn;
The first function exported calls CoInitialize(NULL) and this works fine.
Next some other exported function calls use the pConn variable to check if we can connect to a given database. This works fine and no exceptions are created.
The last function exported calls ::CoUninitialize() and this works ok.
My problem at the moment is that after I call the last exported function I then close my test application. When I close my test application I am getting a serious access violation as follows:
'Unhandled exception in (MSDART.DLL) 0xC0000005: Access Violation'
I have MDAC 2.71.9040.2 installed. I am running on Windows 2k and using MSVC6.0.
Any ideas you can offer me would be greatly appreciated.
Kind Regards,
Chris
|
|
|
|
|
You need to set pConn to NULL before calling CoUninitialize(), it's destructor is being called by your app's exit. A _com_ptr's destructor calls Release on the interface pointer if it's not NULL, and the results after calling CoUninitialize() are undefined. Good luck.
|
|
|
|
|
That solved it. Thank you very much!
Chris
Anonymous wrote:
ForumVisual C++
Subject:Re: ADO Crashing big time!
Sender:Anonymous
Date:13:04 27 Sep '04
You need to set pConn to NULL before calling CoUninitialize(), it's destructor is being called by your app's exit. A _com_ptr's destructor calls Release on the interface pointer if it's not NULL, and the results after calling CoUninitialize() are undefined. Good luck.
|
|
|
|
|
<big><small><small><pre>:laugh::confused: -O
|
|
|
|
|
May be he is Learning ABCD
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
Afternoon Gents (and ladies)
I'm writing an app that uses some information from windows settings to set layout metrics. I've retrieved all the metrics information successfuly, but i'm not sure how to detect when it's changed.
I'd like to have the settings fixed for my object and changed only when the windows appearance is modified, as currently they are tested and updated on every redraw action.
I'm making this component in C#, but i'm looking for the system event to marshal into my program as it will dramatically improve efficiency.
Cheers
Cata
|
|
|
|
|
You should be fine if you handle the WM_SYSCOLORCHANGE message. You could then refresh your color cache. In C#, you have to handle the SystemColorsChanged for the form or control.
Yves
|
|
|
|
|
Thanks, but it's not just the colour.
It's the text size, border sizes, and whether themes are enabled / disabled in XP. If a user changes these without changing the colour, then it won't update properly. I'm sure I read about a system metrics change method somewhere, but it was in the windows SDK.
Any other thoughts?
Cata
|
|
|
|
|
Hello,
I am sure this may have been dealt with by somebody. I am wondering how to load an own bitmap image in place of miscrosoft default icon in VC++ application.
Thanks for help in advance.
Murali
|
|
|
|
|
do you mean the icon in the about box or on the title bar? Just add it to the resource under icon IDR_MAINFRAME. For the about box you could add a picture control and add the bitmap to the resource as a bitmap and have the control reference that bitmap.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I am looking to change the icon at the title bar and the icon in the taskbar of windows when the application is executing. Also, I have only a bitmap of the image. Can you please tell me how I should add my bitmap image to application to show up in title and taskbars.
thanks
Murali
|
|
|
|
|
The icon for the title bar and the task bar come from the icon. Two ways to do this.
1. Convert your bitmap to a .ico file. Microangelo is a great tool to do this.
2. Import in the bitmap. Then copy and paste it over the icon. Both the 32x32 and the 16x16 icons. The only problem with this is that it will distort the bitmap some and sometimes does not look very nice.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Thanks Tom,
I was just following similar to steps you outlined while your email just arrived listing them ). Thanks again. Yes, that is true I lost some resolution in process of step 1 but that is OK for now.
One thing I did (before your email arrived) was generated the *.ico file using "CDMenu V2" trial version of software I obtained from internet. It worked well. However, I COULD NOT get my application to work with ONLY the 32X32 bitsize icon. I am not clear why this was so?
However, after reading your email and creating the 16X16 bitsize icon file as well, then it all worked. Can you explain why only the 32X32 icon file is not sufficient.
Thanks again
Murali
|
|
|
|
|
Is there some type of message I can set up or receive so that my app can tell when a new file is added to a particular folder?
[insert witty comment here]
bdiamond
|
|
|
|
|
|
There's also FindFirstChangeNotification() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
the limitation of the system way of doing things is that it cant watch network folders (afaik) ... depending what ur doing with the files and how often u could just scan the folders every n seconds and update ur list from that
"there is no spoon" biz stuff about me
|
|
|
|
|
l a u r e n wrote:
...it cant watch network folders...
Yes, files and folders on network volumes can be monitored just fine.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
thank you. I accomplished what I was trying to do with ReadDirectoryChangesW() just fine. And it works for me on network folders as long as the drive is mapped. The only problem I'm having now is that I'm trying to let the user cancel 'watching' and start again. I put the function in a separate thread and am calling SuspendThread(),then delete(), which seems to be working, but I was just enlightened by Michael Blake through watching the task manager, this is not working correctly as it is steadily increasing the number of handles and threads being used and could eventually cause Windows to crash.
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
And it works for me on network folders as long as the drive is mapped.
It works with UNC as well.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I've tried using this syntax for the folder name: "\\Server1\files\" with and without ending backslash, and it just won't work for me. when I map the same folder to drive letter and use "L:\" it works just fine. Also, that was only a test. The real folder is a folder that holds zip files for bug reports for our clients that I want to alert me everytime we get a new bug sent and it parses the file and puts it in our bug database for use with our bug program (an app I wrote). If I use my "G:\" drive, I get the notification. If I use the real folder I want, ReadDirectoryChangesW() returns as soon as something is placed in the folder, but it doesn't succeed. A call to GetLastError returns "Unspecified Network Error". Usually ReadDirectoryDirectoryChangesW() hangs until it receives a notification, then continues with code in loop. Do you have any idea what the h___ is going on? Thanks in advance.
[insert witty comment here]
bdiamond
|
|
|
|