|
OK. Here are the details:
I am using Windows Vista. I am developing the application using VS 2005 (C++). I have tried PostMessage & SendMessage. Both have same behavior in both cases.
Thanks.
|
|
|
|
|
Look at the WM_COPYDATA message.
See: Inter-Process Communication using WM_COPYDATA[^]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<a href="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</a>
|
|
|
|
|
Identity Undisclosed wrote: Is there any work around or possible solution
Use a different IPC mechanism (named pipe, shared memory + mutex or event or something)?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You're seeing the correct behavior. UIPI blocks messages sent from a lower-integrity process to a higher-integrity process. If you control the receiving process, you can call ChangeWindowMessageFilter() to allow the message through.
--Mike--
|
|
|
|
|
I'm not sure if this is the right place to put this, but...
I'm using an example program that doesn't use glut that needed a variable
LPCWSTR name1;
I've included:
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <string>
using namespace std;
I get the error message: Run-Time Check Failure #3 - The variable 'name1' is being used without being initialized.
But I think I initialized name1 with the line LPCWSTR name1.
I'm using Visual c++ 2008 Express Edition on a Windows Vista 64 bit.
Thanks for any input!
|
|
|
|
|
You should read this: Windows Data Types[^]. The reference tells you that a type LPCWSTR is: Pointer to a constant null-terminated string of 16-bit Unicode characters. Yes, you've given it a name. This merely allocates memory for the pointer reference. But, where is it in virtual memory? And more importantly, what existing Unicode string does it reference (point to)?
How did you use it in your code? By passing it to a Unicode version of some Windows API? It won't function correctly. The solution is simple: assign it to some existing Uniocode String.
LPCWSTR name1 = L("This is your unicode string.") ;
Probably, the clearest explanation of string usage and conversions are explained in Michael Dunn's Complete Guide to C++ Strings, Part 1[^], and, Part 2[^].
Also, read this: Generic Text Mappings in Tchar.h[^]
|
|
|
|
|
Intrinsic data types (including pointers, which is what LPCWSTR is) are not initialized unless you give them an initial value. For example:
LPCWSTR name1 = NULL;
--Mike--
|
|
|
|
|
Hi,
I have a CLI audio recording program which uses WaveIn and WaveOut to record.
1. I need to prepare buffer and should be able to use for less time i.e., prepare the buffer for 30 mins but should be able to stop at 15 mins and save it to file. I am not able to do this now.
2. I need to get the path of the file. I need to record to a temp file and access it.
The audio's source is Microphone. It can record for custom # of seconds. I mean, when you run VoiceRec.exe and press enter, it would ask you for the # of seconds to record. After I give a number, it prepares the buffer for that time, starts recording and saves it to a file.
But what I want is, I would like to start recording and when the user presses any key, it should stop recording and save it to a WAV file.
http://rapidshare.com/files/240845783/Working_VoiceRecording_2_.rar.html
|
|
|
|
|
This isn't particularly difficult, so what exactly are you having a problem with?
Nikhil_7777 wrote: 1. I need to prepare buffer and should be able to use for less time i.e., prepare the buffer for 30 mins but should be able to stop at 15 mins and save it to file. I am not able to do this now.
Why not? OK, 30 minutes of audio is a fairly big file, but not extreme (even at 48KHz sample rate).
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
What happens is, I am being compelled to create a buffer for the time I need to record which I don't want to.
After preparing the buffer, even if I stop recording in between the file is redording for the entire buffer time. e.g., if I prepare buffer for 30 mins and stop recording at 15 mins, my output wav files is for 30 mins.
VoiceRecording m_Record;
CVoicePlaying m_Play;
m_Record.PrepareBuffer(seconds_to_record1);
|
|
|
|
|
Two solutions to this come to mind :-
1) Only write out to disc the part of the buffer you've used. You can work out how much this is, based on record time, sample size and sample rate.
2) Use smaller buffers, maybe even just a few seconds long, and write these out to disc as they fill. At worst you'll only have one buffer's worth of extra data in the file. (Depending on system usage, performance etc. you could even go down to sub-second buffer lengths.)
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Hi Everyone,
I am working on a project which need to upload the documents to Sharepoint portal.
I am able to get some samples with C# but i am not able to get any samples with C++/MFC.
We are not using .Net in our environment and we want to create a C++ windows service which will upload the documents sharepoint.
If anyone can point me to some samples on how to do it with C++, it will be really helpfull.
Thanks,
KK
Ramchandra
|
|
|
|
|
Hi guys,
I have a qustion in windows programing like this.
I think free was always needed win16 programing because malloc was implmented by GlobalAlloc and system never free its pointer until GlobalFree called. So it makes a system memory leaks.
But nowadays, in win32 system, malloc is implemented by HeapAlloc and do not need call at program exiting anymore, because system frees its heap safely at process died.
Is this true or not?
|
|
|
|
|
norish wrote: But nowadays, in win32 system, malloc is implemented by HeapAlloc and do not need call at program exiting anymore, because system frees its heap safely at process died.
Strictly you are correct - Windows releases a processes resources when the process terminates. However, it's good practise to release resources explicitly, just in case the code gets reused somewhere that it matters. Use smart pointers/resource handles and it becomes easy enough.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks for reply.
I might be correct after all.
However, it's good practise to release resources explicitly
Your point is the very good manner in most case, I know, especially some system handles (like kernel objects) must explicitly release in the code before progaram exits.
So sometimes I use smart pointers for managing such handles.
|
|
|
|
|
Hi
I designed a new dialog class as:
class CDialogBase : public CDialog
{
public:
CDialogBase( CWnd* parent, UINT resId );
virtual ~CDialogBase() { }
protected:
void EvHelp(HELPINFO*);
virtual BOOL OnInitDialog();
virtual void OnOK() {};
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
public:
afx_msg virtual void CMHelp();
DECLARE_MESSAGE_MAP( );
};
I did following:
CAboutDialog *pAboutDialog = new CAboutDialog( .... ); ---> CAboutDialog is inherited from "CDialogBase "
pAboutDialog->DoModal();
But OnInitDialog() is not called. Where is the problem?
Thanks,
|
|
|
|
|
pAboutDialog->DoModal(); will immediatelly return?
If then instantiation of CAboutDialog has some error.
I know a case cause this situation.
Check the resource id is exist and reffer exact dialog resource.
If resource id is valid, I'm not sure, maybe some declaration is not matched their prototypes or no appropriate message mapping macro defined...
|
|
|
|
|
Yes, pAboutDialog->DoModal()will immediatelly return.
|
|
|
|
|
Then problem is decided to initializing an instance.
All constructor of CAboutDialog, CDialogBase, CDialog are initializing correctly?
Are there some members not initilized or have invalid value?
You can check it by debug mode and step into function.
|
|
|
|
|
transoft wrote: DECLARE_MESSAGE_MAP( );
Did you do the BEGIN_MESSAGE_MAP()/END_MESSAGE_MAP() thing correctly? CDialogBase needs that...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, I did as following:
BEGIN_MESSAGE_MAP( CDialogBase, CDialog )
ON_COMMAND(IDHELP, CMHelp)
ON_WM_HELPINFO()
END_MESSAGE_MAP()
|
|
|
|
|
you are missing the ON_WM_INITDIALOG in the message map.
|
|
|
|
|
transoft wrote: CAboutDialog *pAboutDialog = new CAboutDialog( .... ); ---> CAboutDialog is inherited from "CDialogBase "
pAboutDialog->DoModal();
Just out of curiosity, why not use:
CAboutDialog pAboutDialog;
pAboutDialog.DoModal(); Do you have any controls on CAboutDialog with associated member variables? Is DoDataExchange() correct? Have you tried adding the DS_NOFAILCREATE style?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Most probably it fails during dialog construction (CreateDialogIndirect).
Invalid or changed IDD (rebuild needed?), ActiveX added in dialog but not (correctly) installed etc.
Or perhaps you are mapping in the same .exe multiple dlls and there is a clash between resource IDs?
BTW, why new CAboutDialog and not
[code]
CAboutDialog dlg;
dlg.DoModal();
[/code]
Nuclear launch detected
|
|
|
|
|
How to show a Modal Dialog box while i am doing some manipulation to my data before showing it to a grid.
Do i have to start any thread for it .??
Or should I set any event for it..?
|
|
|
|