|
Dudi Avramov wrote: I'd like to know if the assignment operation to int (like int i; i=5; ) is atomic.
No, absolutely not. There is much more to atomic operations.
1.)The LOCK[^] prefix must be present to instruct the processor that it has exclusive memory access to the variable location.
2.) Modern processors perform speculative fetching and instruction reordering so the code being executed should be serialized before the atomic operaration with SFENCE[^]/LFENCE[^]/MFENCE[^] The volatile keyword[^] should give the compiler a hint that it needs to prevent out-of-order execution which may result in a Memory Barrier[^].
Interlocked Variable Access[^]
Synchronization and Multiprocessor Issues[^]
Best Wishes,
-David Delaune
|
|
|
|
|
Is it possible that the mov assembly instruction is not atomic?
|
|
|
|
|
It is possible that it's not atomic - if the processor doesn't have the bus locked while performing the MOV, some other bus attached hardware (like, for example, the other core of the processor, or some hardware performing a DMA) could theoretically write to that memory location if it has precedence over the current processor.
|
|
|
|
|
can u plz advice me how i can decode pdf format and add it into device..that it gonna used as firmware... it is a prestigious matter for me because i was insulted bitterly in a electronics forum for this question of making a pdf reader device.. so it became a challenge to make it possible.. can u just help me to establish my dream??
Every man is unique
|
|
|
|
|
Do you want to make a device able to understand the PDF format?
Have a look to this article [^], with in turn will shortly redirect you to the PDF specifications.
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]
|
|
|
|
|
i am so greatful to u, thanks thanks....if u have any other idea or article known plz let me know..
Every man is unique
|
|
|
|
|
I enumerate all open windows with Enumwindows. In the processor function I try to check if the title of the window contains a certain string. If yes, put the handle in a list of handles(m_wndList).
if(hwnd)
{
CWindow win(hwnd);
CHAR str[100];
win.GetWindowText((LPTSTR)(str),100);
if (strncmp(str,"searchstring", 13) == 0)
dlg->m_wndList.push_back(hwnd);
}
It compiles, but I get the following error messages:
Run-time Check Failure #2: Stack around the variable str is corrupted
and/or
Run-time Check Failure #2: Stack around the variable win is corrupted
What is the problem? How should I change my code?
|
|
|
|
|
There's some problems with your code. What's with the (LPTSTR) nonsense? My guess is that you're building a Unicode application and casting away the compiler warnings (the (LPTSTR) cast I mentioned before) which were informing you of the real problem: that CHAR str[100]; is not a Unicode string. Try this:
if(hwnd)
{
CWindow win(hwnd);
TCHAR str[100];
win.GetWindowText(str, 100);
if (_tcsncmp(str, _T("searchstring"), 13) == 0)
dlg->m_wndList.push_back(hwnd);
}
Don't cast unless you're sure what the cast actually means, and don't try to cast away error messages.
Steve
|
|
|
|
|
To complement the answer from Stephen, I suggest you read this excellent article[^]. You'll be able to really understand why your code is wrong.
|
|
|
|
|
Thanks guys, you both helped me a lot. At the moment I just cut & paste any code I find, but this will change I hope.
|
|
|
|
|
keret wrote: if (strncmp(str,"searchstring", 13) == 0)
Why 13?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I had an other searchstring originally.
|
|
|
|
|
Before Vista, it seems that the design of mac os is better than of Windows.
I want to know if Vista or Windows 7 is trying hard to redesign,
and how far it can go considering compatability.
How about totally redesign, and make xp as a subsystem for compatability.
|
|
|
|
|
followait wrote: Before Vista, it seems that the design of mac os is better than of Windows.
So, in your opinion Unix architecture is better than Windows one?
followait wrote: How about totally redesign, and make xp as a subsystem for compatability.
The (latest) big turn (IMHO), in Windows evolution was the adoption of the NT architecture.
XP 's one is fair good, Vista & Windows 7 , AFAIK aren't such a redesign.
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: So, in your opinion Unix architecture is better than Windows one?
After I comparing them via some architecture illustrates.
Mac's is more clear than Windows' from this perspective.
|
|
|
|
|
Hello,
I wrote a program that export as pdf format (as string,bitmap)
and now i want to export as Excel office (ex. as version 2003)
What's the best class for generate 'Excel' document with vc++ 6.0?
|
|
|
|
|
You may go through automation, see, for instance [^].
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]
|
|
|
|
|
Hi,
I wanted to transfer some files from the remote machine(which is located in same LAN) to local machine. For that i am going to use WGET command.
Can any one help me how to use this command for transferring files, because it is expecting http and ftp formats only.
I have tried with shared path, it's not working... Can any one help me regarding this..?
Thanks
Venkatesh.
|
|
|
|
|
Venkatesh,
This is the C++ forum. You will probably get a better response from the System Admin[^] forum.
I have WGET on my Unix based server and doing 'wget -h' produced a verbose list of options.
Best Wishes,
-David Delaune
|
|
|
|
|
Hi there,
I would like to register an ActiveX programmatically, but I encounter several problems.
First of all, I register my ActiveX in the program and it works correctly like this:
ShellExecute(m_hWnd,"open", "regsvr32", "D:\\WINNT\\system32\\Macromed\\Flash\\Flash9f.ocx", "", SW_HIDE );
But I'm interested in hiding the dialog after registering.
Also, how can I find out that is this ActiveX registered already?
On the other hand, I would like to check ActiveX registeration on the local system and if it doesn't register, register it.
I think CoCreateInstance can help me to recognize, but I'm not sure.
Please help me my friends.
Thanks in advance.
|
|
|
|
|
regsvr32 has a /s option that will not show the message box at all.
You can also register a component by loading it using LoadLibrary and calling its exported DllRegisterServer function.
To find if the ActiveX is already registered, check if the following registry key exists.
HKEY_CLASSES_ROOT\CLSID\<CLSID of ActiveX>\InProcServer32
The value of Default of the above key will contain the path to the ActiveX.
«_Superman_»
|
|
|
|
|
You may also register it (programmatically) loading the corrensponding DLL and the calling DllRegisterServer .
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]
|
|
|
|
|
I tried this[^] Google search got the following result (1st in list):
http://msdn.microsoft.com/en-us/library/ms177531(VS.80).aspx[^]
What follows is a quote from the page:
The REGSVR sample is the source code to the existing REGSVR32.EXE utility. This utility is used to invoke the self-registration code built into ActiveX controls that adds or removes a control's information in the registry. Developers can use this sample to modify the behavior of the REGSVR32 utility.
Don't be afraid to use Google!
Steve
|
|
|
|
|
I have created dynamic buttons and loaded a plain bitmap on them. Now I want to place a text on those bitmapped buttons, how can we do that?
|
|
|
|
|
As far as i know the "default" buttons given to you by windows don't support both images and text on a button, so i'd say you have 3 possibilities:
1. Use a third party custom button which supports both text and image
2. Handle drawing of the button yourself, you have to be able to draw all its possible states, like pressed, disabled, ... and adding theme support is usually also a good idea
3. This is imho the easiest and simplest solution, draw the text onto the bitmap you place on the buttons. So load the bitmap, draw text on it and feed it to the button. If you need to change the text, load it again, draw the new text, feed it to the button.
I hope this helps, good luck.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|