|
>Are you really using menus (i.e. CMenu, ... ) ???
Very good question. I do not use CMenu, instead I did Insert->Resource->Menu and wrote menu items. Next I involved the "dialog properties" and selected this menu in a listbox.
I didn't use directly CMenu.
About csenario: "...first list is filled with car manufacturer"
I have ~80 manufacturers without China market I think, finally it may be ~100.
------------------------------------
I've spent else a bit time and now I'm knowing a bit more...
1. This bug isn't a "news". And I'm not the first person who has detected it.
2. On old version of VC there was a bug: Wizard supports file .CLW upto 64K. Not bigger.
Microsoft had fixed this bug, but unfortunatelly at "microsoft manner".
I've done some experiments and now I know:
1. Wizard can create a long .CLW. But wizard cannot read .CLW above certain size.
2. There are many types of resources in the .CLW. Wizard places all those types on the DIFFERENT stacks each type. Therefore I have no problem to add dialogs (currently I have 65 dialogs, they require a short space). But I have problem to add menu items (currently 1096).
|
|
|
|
|
I could be missing something obvious here, but how do you keep your application up to date? Cars and manufacturers come and go on a frequent basis. With every change you will be recompiling your resources and re-linking your application. That seems an odd and certainly unconventional way of doing it. ie. That's a lot of maintenance work. Just curious.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
hint: cheap labor.
Nihil obstat
|
|
|
|
|
Member 708172 wrote: This project operates with cars
Ok.
Member 708172 wrote: that are splitted by models.
That has nothing to do with cars. It has to do with design of the software.
And it is wrong.
Member 708172 wrote: No, you don't, but somehow you are sure that our users are not happy to navigate
through this menu.
I suspect however that your users do not care equally about every single model though.
So let us say hypothetically (and only that) that they do not want to use a dialog to select the car. Then you provide a way to dynamically add the cars that they do care about to the menu.
Presumably that is a feature that you have seen in other applications. Such as text processors.
Member 708172 wrote: Who from you solved a problem to combine over 1000 cars in an one project?
Not a project - a menu.
Member 708172 wrote: make your suggestions...
A dialog where they select make then model. Which is certainly what I have seen on every car app that I have seen. And if you want then you can let them add them to the menu.
Might note of course that make/model might not even be sufficient but trying to map variations after that to a menu would make it that much harder. But it is just another drop down in a dialog.
|
|
|
|
|
Consider the code below:
#include <stdio.h>
#include <stdlib.h>
#define FORCE_CAST(var, type) *(type*)&var
struct processor_status_register
{
unsigned int cwp:5;
unsigned int et:1;
unsigned int ps:1;
unsigned int s:1;
unsigned int pil:4;
unsigned int ef:1;
unsigned int ec:1;
unsigned int reserved:6;
unsigned int c:1;
unsigned int v:1;
unsigned int z:1;
unsigned int n:1;
unsigned int ver:4;
unsigned int impl:4;
}__attribute__ ((__packed__));
struct registers
{
unsigned long* registerSet;
unsigned long* globalRegisters;
unsigned long* cwptr;
unsigned long wim, tbr, y, pc, npc;
unsigned short registerWindows;
struct processor_status_register __attribute__ ((aligned (8))) psr;
}__attribute__ ((__packed__));
int getBit(unsigned long bitStream, int position)
{
int bit;
bit = (bitStream & (1 << position)) >> position;
return bit;
}
char* showBits(unsigned long bitStream, int startPosition, int endPosition)
{
char* bits = (char*)malloc(endPosition - startPosition + 2);
int bitIndex;
for(bitIndex = 0; bitIndex <= endPosition; bitIndex++)
bits[bitIndex] = (getBit(bitStream, endPosition - bitIndex)) ? '1' : '0';
bits[bitIndex] = '\0';
return bits;
}
int main()
{
struct registers sparcRegisters; short isLittleEndian;
unsigned long checkEndian = 0x00000001;
if(*((char*)(&checkEndian)))
{printf("Little Endian\n"); isLittleEndian = 1;} Endian architecture detected
else
{printf("Big Endian\n"); isLittleEndian = 0;} Endian architecture detected
unsigned long registerValue = 0xF30010A7;
unsigned long swappedRegisterValue = isLittleEndian ? registerValue :
__builtin_bswap32(registerValue);
sparcRegisters.psr = FORCE_CAST(swappedRegisterValue, struct
processor_status_register);
registerValue = isLittleEndian ? FORCE_CAST (sparcRegisters.psr,
unsigned long) : __builtin_bswap32(FORCE_CAST (sparcRegisters.psr,
unsigned long));
printf("\nPSR=0x%0X, IMPL=%u, VER=%u, CWP=%u\n", registerValue,
sparcRegisters.psr.impl, sparcRegisters.psr.ver,
sparcRegisters.psr.cwp);
printf("PSR=%s\n",showBits(registerValue, 0, 31));
sparcRegisters.psr.cwp = 7;
sparcRegisters.psr.et = 1;
sparcRegisters.psr.ps = 0;
sparcRegisters.psr.s = 1;
sparcRegisters.psr.pil = 0;
sparcRegisters.psr.ef = 0;
sparcRegisters.psr.ec = 0;
sparcRegisters.psr.reserved = 0;
sparcRegisters.psr.c = 0;
sparcRegisters.psr.v = 0;
sparcRegisters.psr.z = 0;
sparcRegisters.psr.n = 0;
sparcRegisters.psr.ver = 3;
sparcRegisters.psr.impl = 0xF;
registerValue = isLittleEndian ? FORCE_CAST (sparcRegisters.psr,
unsigned long) : __builtin_bswap32(FORCE_CAST (sparcRegisters.psr,
unsigned long));
printf("\nPSR=0x%0X, IMPL=%u, VER=%u, CWP=%u\n", registerValue,
sparcRegisters.psr.impl, sparcRegisters.psr.ver,
sparcRegisters.psr.cwp);
printf("PSR=%s\n\n",showBits(registerValue, 0, 31));
return 0;
}
//////////////////////////////////////////////////////////////////////////////
I have used gcc-4.7.2 on Solaris 10 on SPARC to compile the following
code to produce the Big-Endian output:
Big Endian
PSR=0xF30010A7, IMPL=3, VER=15, CWP=20
PSR=11110011000000000001000010100111
PSR=0x3F00003D, IMPL=15, VER=3, CWP=7
PSR=00111111000000000000000000111101
//////////////////////////////////////////////////////////////////////////////
I have used gcc-4.4 on Ubuntu-10.04 on Intel-x86 to compile the
following code to produce the Little-Endian output:
Little Endian
PSR=0xF30010A7, IMPL=15, VER=3, CWP=7
PSR=11110011000000000001000010100111
PSR=0xF30000A7, IMPL=15, VER=3, CWP=7
PSR=11110011000000000000000010100111
//////////////////////////////////////////////////////////////////////////////
While the later one is as expected, can anyone please explain the
Big-Endian counterpart? Considering the showBits() method to be
correct, how can PSR=0x3F00003D give rise to IMPL=15, VER=3, CWP=7
values? How is the bit-field is being arranged and interpreted in
memory on a Big-Endian system?
|
|
|
|
|
As far as I recall the bit fields in a structure are described in right to left order on x86. I cannot recall if this is true for Sparc also; it's been a while. However, the best way to check is to look at the compiler documentation: this is Microsoft's take on the issue[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
The short answer is that bit-field allocation/alignment is pretty much totally at the mercy of the implementation, according to the standards.
In other words, the compiler writer can do almost anything she wants, as long as it's internally consistent.
Have fun!
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
Have you noticed that the number of 1's in first PSR output is 11 while on the second case it is 12 ? How can bit reordering change number of 1's?
|
|
|
|
|
No idea.
Suggestion: write a little test that sets each bitfield in turn to all 1's, then dump PSR. That should tell you exactly where each one lives in each implementation.
Good hunting,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
The way I implemented showBits() and getBit(), is it platform-independent? It works correctly on Little Endian platform, I can assure.
|
|
|
|
|
Hi everyone
How can I find threads belong to a specific process?
Is there any api for it?
|
|
|
|
|
|
I have checked your link but I dont know why its result is different with Task manager
Task manager shows 3 threads for calc.exe but this code generate these info
Thread ID = 0x00016E0
base priority =8
delta priority =0
Thread ID= 0x0000558
base priority =8
delta priority =0
Thread ID= 0x0000115C
base priority =15
delta priority =0
could you help me
|
|
|
|
|
messages wrote: Task manager shows 3 threads for calc.exe... And your code's output shows the identifier of three threads. What were you expecting?
messages wrote: ...but this code generate these info... The code uses GetCurrentProcessId() . How did you go about getting the process identifier for calc.exe?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 11-Dec-12 10:52am.
|
|
|
|
|
I used of Task manager for get PID
|
|
|
|
|
Ok, I ran that exact code, only changing:
if (te32.th32OwnerProcessID == 4948)
and it produced:
THREAD ID = 0x00000CB8
base priority = 8
delta priority = 0
THREAD ID = 0x00000B18
base priority = 8
delta priority = 0
THREAD ID = 0x000014B0
base priority = 15
delta priority = 0
Given calc's three threads, that's what I would expect.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
modified 11-Dec-12 13:02pm.
|
|
|
|
|
Got it rise and shine sleepyhead it has 3 "THREAD ID " so its 3 threads for calc.exe,is it correct?
|
|
|
|
|
Who's got experience with this class then? Examples and documentation seem pitifully thin on the ground.
I'm just playing with it to see if it's the right control for a new development.
At the moment I'm wondering how to add a button to a property. The doc suggests overloading the protected "HasButton" function
"Indicates whether a property contains a button." says MSDN
So I don't know if I'll get a button by overloading this and returning TRUE because my overloaded function never gets called; other protectesd functions that don;t ever seem to be called are Init, CreateCombo or IsValueChanged
maybe I'm contructing my CMFCPropertyGridProperty wrong?
Thanks for looking.
|
|
|
|
|
I'm getting the same behavior as I suspect you did trying to override the CreateCombo function in a property class derived from CMFCPropertyGridProperty. Did you ever resolve this?
AlexJ
|
|
|
|
|
Hi,
I want to hook the task bar for that I have used SetWindowHookEx() function in a DLL.
But it it not working all times.
I know the task manager handle using FindWindow() API.
I want to catch the window procedure of the task bar using the task bar handle?
how to do this please help me?
|
|
|
|
|
You can find this information using the GetWindowInfo function[^] to get the class reference of the window, and then GetClassInfoEx [^] to find the pointer to the Windows procedure.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
You might use GetWindowLong with GWL_WNDPROC as second parameter (see MSDN[^]).
Veni, vidi, vici.
|
|
|
|
|
Hi,
I need some clarification on one point. We normally use static variables in C/C++. We say when we have used a static variable inside a function, it persists its previous value when that function is called again & again, e:g: to say, static variable retains its last value when that function is called again.
Can anybody explaing me the logic behind this. How a static variable knows its last value and how it is not initialized everytime on the function call.
Regards,
Mbatra
|
|
|
|
|
Because a static variable, even when declared in side a func, is created in the DATA section of a programs run space. Think of it like a global static variable that gets initialised to zero and whose value is of course persistent.
An ordinary variable declared inside a func is created on the stack. This of course winds back and forwards so when the func returns the space that variable used is lost to the next func you call.
|
|
|
|
|