|
i solved it...
but error occurs when i transfer the data to edit box...
m_txtlog=g_MyVariable;
UpdateData(FALSE);
Error occurs while displayin
|
|
|
|
|
hellogany wrote: Error occurs
Which error ? Please be specific, we can't see what is displayed on your screen.
|
|
|
|
|
Really, I've been doing it that way for years!
(I suppose that's how I was taught to declare variables in embedded systems.)
Does it matter?
Ali
|
|
|
|
|
- If you don't include such header in any source file then you get 'undifined symbol' by the linker.
- If you include the header in multiple source files then you get 'multiple definitions' by the linker.
- If you include the header into exactly one source file then the linker will cheer you.
Of course this is going on my ...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: If you include the header into exactly one source file then the linker will cheer you.
That's what I do, I declare my global variable in a header called 'Globals.h', then include it just once!
Then I declare it as extern in Externs.h and include it wherever I want to use it .....
The linker is happy, but I thought you considered it a bad habit or bad style and I wondered why ..... maybe I missunderstood ......
Ali
|
|
|
|
|
Well, if you define the global variable into a source file then you lower the probabilities of duplicate inclusion...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Well
While Debugging, i m able to get the value ....
But couldnt able to display in edit control.
Its throws Assertin Error
|
|
|
|
|
Please post the (relevant) code.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
m_txtlog=g_MyVariable;
UpdateData(FALSE);
m_txlog is the edit control
i am using the above code in oncreate function...
|
|
|
|
|
You cannot do that in the on OnCreate method, since controls not yet exist.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The problem here is that you have a terminology issue.
You declare the variable in HEADER file (something.h) that can be freely included in SOURCE files (*.c / *.cpp)
extern int g_MyVariable
Where you and other have an issue is that you implement the variable in another .h file, that you actually treat like a source file.
So, your compiler builds some cpp file, that is the only file including this special header.
As long as you are disciplined about this, you'll be fine.
But anyone else coming along will be puzzled.
Some day you'll make a mistake...
If you put the actual implementation
int g_MyVariable = 0;
in a source file, then you can't make this mistake.
OK, you can, but any line like:
#include "globalvars.cpp"
is going to be really obvious.
I hope that helps a little...
Iain.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
|
Hi All,
Could any one help me how I can get all drives along with the hidden drives in windows. I am searching in msdn. I am not getting any good clue how to do it. Please help me if you know showing hidden drives using mfc / c++ to get the hidden drives info. If I got solution i will share the same.
[I mean Hidden drive is, if I remove drive letter in device manager then the drive will be disappear for user. The actual drive & content will be existed in windows. If i go to Disk manager, I can again assign drive letter back and can see the drive.]
Thanks in advance for help.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
Any entries in the Registry after the removal from Device manager?
Key - HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices
Selva
|
|
|
|
|
ya. When I remove drive letter then the registry is changing.
I removed "MyDrive(F " its registry value is changed to some GUID. Thanks for clue. I am trying some windows MSDN sample. http://msdn.microsoft.com/en-us/library/cc542456%28v=VS.85%29.aspx[^]
If you have any other solution share...
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
You're talking about partitions, not drives. A partition is mounted on a mount point. Mount points are:
1) drive letter
2) empty directories on NTFS volumes.
To manipulate (or list) these, you can use the command line utility mountvol , (Vista & up)
or you can read this article: Reparse Points in Vista[^]
|
|
|
|
|
Yes. I am looking for partitions itself. Thanks for your help.
Looks like the msdn link[^] is working. I need to do some customization on it and take some part of it. Thanks a lot for reply.
Nice talking to you. If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
I am writing a plugin for an existing application, which allows me to create a tool window and provides standard controls from their own SDK to use on the tool window.
The problem is thier sdk is inssuficient and lacks many standard things such as a main menu and context menu etc,so I like to use Windows API controls on this tool, but I dont have access to this window's WndProc function. All the callbacks are handled internally by the main application which is seemingly hidden.
I am able to find the Hwnd for this tool window using a spy tool. How would I go about adding my own Winapi controls on this window and how would I catch the messages sent by the controls without having access to the WndProc() or the Main() function of the application?
If I initiate a seperate WndProc function, it will conflict with the main application and crashes it.
There are several overload function for the tool window which the application provides. These inculde the OnPaint() and OnIdle() functions.
I was able to do some basic things like painting a rect onto this window so I know I am accessing it correctly.
Any help would be much appreciated.
Frank
|
|
|
|
|
Well, if you are able to access the HWND, you can use GetWindowLongPtr[^], SetWindowLongPtr[^], and CallWindowProc[^].
GetWindowLongPtr will get you the address of the funcion, then you can set it to the custom procedure, which can then call the old procedure.
|
|
|
|
|
Than you very much, after some fiddling on google regarding these functions I managed to reroute the message to my custom procedure and now life is getting better.
Thanks to steve as well for pointing in the right direction
|
|
|
|
|
The two main ways to do this would be:
Steve
|
|
|
|
|
I am starting new development of an audio analysis application - basically real time (or as close to real time as possible) FFT and filtering of signal from noise.
I have been looking at Windows multimedia and would like to know if DirectSound would be a better choise.
I am little uncomfortable with Windows MM usage of "buffers" and actually read an article here recomending tripple buffering.
Sounds unnecessary complex.
Any constructive opinions are as always appreciated.
References to "google it " and off the subject commetaries are not welcome.
Thanks for your time.
Vaclav
|
|
|
|
|
Vaclav_Sal wrote: References to "google it " and off the subject commetaries are not welcome.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
How about DirectShow[^], could that suit your needs?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
While messing around with Windows programming I found something odd.
When I have a window at (0,0), and the width is 1680, the height is 1050, and GetSystem metrics says that is the height and width of the screen; however the window does not fill up the entire screen. (e.g. there are exactly three pixels it does not cover on the right)
Any thoughts was to what might be happening?
---------------------
Okay, two things to add:
- Since I had altered the message processing so that it would be as if the non-client area did not exist, I was using GetClientRect to find the values for position and size. It sets left and top to zero, so the position could have been wrong.
- I had shifted the window up and to the left to place the 0,0 of the client area at 0,0 on the screen. Further testing shows that the calculations I had preformed were correct for a window with no style so this should not have been a problem.
Therefore it would seem I have somehow managed to prevent the non-client area from being created, as all non-child windows normally have a border of some type and a caption even if those things are not specified in the style. Will confirm this later with a few more tests.
---------------------
Apperently there is no non-client area if you eat the WM_NCCALCSIZE message, so my adjustments to the windows position to account for the non-client area was unneeded. This fact is not in the documentation of the message . Would have saved a lot of trouble. So, my code was correct per the documentation of the Windows API, but it was something they forgot to mention that was the root of the problem (as I had expected, though I was looking in the wrong place).
|
|
|
|