Display balloon tooltip in systemtray - visual-c++

this is my code..
set trayicon
.......
NOTIFYICONDATA data;//this is global variable.
case WM_CREATE :
data.cbSize = sizeof(NOTIFYICONDATA);
data.hWnd =hWnd;
data.uID = IDR_MAINFRAME;
data.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
data.uCallbackMessage = ID_TRAYICON_NOTIFY;
data.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INFO));
wcscpy_s(data.szTip,128,a);
Shell_NotifyIcon( NIM_ADD, &data );
........
and set balloon
......
case WM_RBUTTONDBLCLK:
data.hWnd = hWnd;
data.cbSize =sizeof(NOTIFYICONDATA);
data.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_INFO));
data.uTimeout = 5000;
data.uFlags = NIF_INFO;
data.dwInfoFlags = NIIF_INFO;
_tcscpy_s(data.szInfoTitle,_T("TITLE"));
_tcscpy_s(data.szInfo,_T("SOME TEXT"));
Shell_NotifyIcon(NIM_MODIFY,&data);
.......
but, can't show balloon tooltip
plz teach me.

You should check shell32.dll version, and set cbSize to (as described in the Remarks section of the NOTIFYICONDATA docs):
sizeof(NOTIFYICONDATA) if version is >=6.0.6
NOTIFYICONDATA_V3_SIZE if version is 6.0 (WinXP)
NOTIFYICONDATA_V2_SIZE if version is 5.0 (Win2000)
NOTIFYICONDATA_V1_SIZE if version is <5.0 (NT4/95/98)

I found the code in the official docs for detecting windows versions wasn't quite right.
This should work better:
Try this for size (literally):
BOOL CheckWindowsVersion(DWORD dwMajor, DWORD dwMinor, DWORD dwBuild)
{
// Initialize the OSVERSIONINFOEX structure.
OSVERSIONINFOEX osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
osvi.dwMajorVersion = dwMajor;
osvi.dwMinorVersion = dwMinor;
osvi.dwBuildNumber = dwBuild;
// Initialize the condition mask.
DWORDLONG dwlConditionMask = 0;
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_MINORVERSION, VER_GREATER_EQUAL);
VER_SET_CONDITION(dwlConditionMask, VER_BUILDNUMBER, VER_GREATER_EQUAL);
// Perform the test.
return VerifyVersionInfo(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_BUILDNUMBER, dwlConditionMask);
}
Then when you want to set the icon you can test for the correct windows version. For some reason in the official docs they were only checking for 6.1, when it should be 6.0.6 + all the other windows versions...
if( CheckWindowsVersion(6, 0, 6))
data.cbSize = sizeof(NOTIFYICONDATA);
else if( CheckWindowsVersion(6, 0, 0))
data.cbSize = NOTIFYICONDATA_V3_SIZE;
else if( CheckWindowsVersion(5, 0, 0))
data.cbSize = NOTIFYICONDATA_V2_SIZE;
else
data.cbSize = NOTIFYICONDATA_V1_SIZE;
I didn't fully test the VER_BUILDNUMBER part yet, but I presume this must be close.

Related

How to include a for and multidimensional array in the body of php mailer?

I am using PHP Mailer.
I want to add dynamic content in php to the body but I am not being able to do it.
If I add this on the php mailer body, it works.
$mail->Body="<h3>Dados do 1º Titular</h3><ul><li><b>Nome: </b>".$titular1_name."</li><li><b>Idade: </b>".$titular1_idade."</li><li><b>Estado Civil</b>".$titular1_estado_civil."</li><li><b>Dependentes</b>".$titular1_dependentes."</li><li><b>Rendimento</b>".$titular1_rendimento."</li><li><b>Penhora</b>".$titular1_penhora."</li></ul><h3>Dados do 2º titular</h3><ul><li><b>Nome: </b>".$titular2_name."</li><li><b>Idade: </b>".$titular2_idade."</li><li><b>Estado Civil</b>".$titular2_estado_civil."</li><li><b>Dependentes</b>".$titular2_dependentes."</li><li><b>Rendimento</b>".$titular2_rendimento."</li><li><b>Penhora</b>".$titular2_penhora."</li></ul><h3>Dados de Contacto</h3><ul><li><b>Email: </b>".$titular_email."</li><li><b>Telefone</b>".$titular_phone."</li><li><b>Localidade</b>".$titular_local."</li></ul>";
But I need to add this result:
for ($y = 0; $y <= $numberOfRows; $y++){
for ($x = 0; $x < $maxData; $x++) {
array_push($row, $credito,
$capital_divida, $prestacao,
$bank, $garantias, $situacao);
echo $row[$x]."<br>";
}
array_push($fullData, $row);
}
This is my relevant code for this issue:
$row = array();
$fullData = array();
$maxData = 6;
$numberOfRows = htmlspecialchars(["numberOfRowsHTML"]);
$titular_email = htmlspecialchars($_POST["titular-email"]);
$titular_phone = htmlspecialchars($_POST["titular-phone"]);
$titular_local = htmlspecialchars($_POST["titular-local"]);
$titular_message = htmlspecialchars($_POST["titular-message"]);
$numberOfRows = htmlspecialchars(["numberOfRowsHTML"]);
$credito = htmlspecialchars(["credito"]);
$capital_divida = htmlspecialchars(["capital_div"]);
$prestacao = htmlspecialchars(["prestacao"]);
$bank = htmlspecialchars(["bank"]);
$garantias = htmlspecialchars(["garantias"]);
$situacao = htmlspecialchars(["situacao"]);
Thank you in advance for all the help
This code doesn't make any sense:
$numberOfRows = htmlspecialchars(["numberOfRowsHTML"]);
It looks like you're missing the name of an array you want to get this value from, for example:
$numberOfRows = htmlspecialchars($_POST["numberOfRowsHTML"]);
Your loop that assembles the array doesn't appear to do anything useful at all - you're getting values from the submission, then assembling an array which you don't use. It would be helpful if you could clarify what it is you're trying to do.

How to draw dimensions between sleeve (specialty equipment) and Grid lines

we want to draw dimensions between sleeve (specialty equipment) and Grid lines .
but when we apply dimensions revit throw the error message "Remove References - The references of highlighted dimension are no longer parallel"
XYZ sleeve_xyz = null;
Element elm = doc.GetElement(Sleeve_id.Id);
FamilyInstance fi = elm as FamilyInstance;
Autodesk.Revit.DB.Location position = elm.Location;
Autodesk.Revit.DB.LocationPoint positionPoint = position as Autodesk.Revit.DB.LocationPoint;
sleeve_xyz = positionPoint.Point;
sleeve_xyz = new XYZ(sleeve_xyz.X, sleeve_xyz.Y, 0);
Reference sleeve_ref = GetSleeveReference(fi, SpecialReferenceType.CenterLR);
Grid first_grid2 = doc.GetElement(First_Grid_elemID) as Grid;
Reference gridRef = null;
Options opt = new Options();
opt.ComputeReferences = true;
opt.IncludeNonVisibleObjects = true;
opt.View = doc.ActiveView;
foreach (GeometryObject obj in first_grid2.get_Geometry(opt))
{
if (obj is Autodesk.Revit.DB.Line)
{
Autodesk.Revit.DB.Line line = obj as Autodesk.Revit.DB.Line;
gridRef = line.Reference;
}
}
XYZ gr_point2 = new XYZ(grid_intersection_point.X, sleeve_xyz.Y, 0.000000000);
Autodesk.Revit.DB.Line line5 = null;
line5 = Autodesk.Revit.DB.Line.CreateBound(gr_point2, sleeve_xyz);
ReferenceArray refArray = new ReferenceArray();
refArray.Append(sleeve_ref);
refArray.Append(gridRef);
Dimension dim = doc.Create.NewDimension(doc.ActiveView, line5, refArray);
Error
Create a dimension that works manually through the user interface first, then use RevitLookup to analyse its properties and find out what exact references it has picked up. In general, if a feature is not available in the Revit product manually through the user interface, then the Revit API will not provide it either.

Start client fullscreen doesn't cover wibox

When a client is started, it should be started fullscreen. I tried to configure this using rules but no matter what I do, the client doesn't cover the wibox.
What I have so far:
function set_fullscreen(c)
mywibox[c.screen].ontop = false
c.fullscreen = false
c.fullscreen = true
c.x = 0
c.y = 0
mywibox[c.screen].ontop = false
c.fullscreen = false
c.fullscreen = true
c.x = 0
c.y = 0
end
awful.rules.rules = {
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
keys = clientkeys,
buttons = clientbuttons } },
{ rule = { class = "<name>" },
properties = { fullscreen = true,
size_hints_honor = false,
focus = true },
callback = set_fullscreen }
}
I have my wibox on the bottom and the application gets painted above the wibox. It also gets painted off-screen above, the size of the wibox. The application seems to have the correct size, but the wibox seems to be in the way.
When I toggle fullscreen for the application, when it is already running, fullscreen works as expected. The application does cover the wibox.
function toggle_fullscreen(c)
c.fullscreen = not c.fullscreen
end
I also have a signal handler that toggles ontop for the wibox when a focussed client's fullscreen property changes:
client.connect_signal("property::fullscreen", function (c)
if c.fullscreen and c == client.focus then
mywibox[c.screen].ontop = false
else
mywibox[c.screen].ontop = true
end
end)
Nothing what I do seems to start the application in fullscreen, I always have to toggle manually. Anybody any idea what I am doing wrong?
client.connect_signal("property::fullscreen", function (c)
if c.fullscreen and c == client.focus then
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
else
mywibox[mouse.screen].visible = not mywibox[mouse.screen].visible
end
end)
Work for me.
This should help:
function toggle_fullscreen(c)
c.fullscreen = not c.fullscreen
--TODO store the existing ontop state
c.ontop = c.fullscreen
c:raise()
end

How to set Spinner selection by value, using CursorAdapter

I have a spinner I'm populating from the database. I want to choose which item from the list is selected by default. I need to find out what item in the list (CursorAdapter) has the value "Default Away" and set that to the selected value.
Spinner away_team_spinner = (Spinner)findViewById(R.id.away_team_spinner);
DatabaseHelper db = new DatabaseHelper(this);
Cursor team_list = db.getTeams(p_game_level);
startManagingCursor(team_list);
String[] team_name = new String[]{colTeamName};
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter adapter =
new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, team_list, team_name, to );
adapter.setDropDownViewResource( android.R.layout.simple_spinner_dropdown_item );
away_team_spinner.setAdapter(adapter);
//// HERE IS WHERE MY ERRORS START ////
Log.i("NEW_GAME","Before set arrayadapter");
CursorAdapter adapter_choose = (CursorAdapter)away_team_spinner.getAdapter();
Log.i("NEW_GAME","Before set setSelection");
away_team_spinner.setSelection(adapter_choose.getPosition("Default Away"));
This is the "solution" I found by searching on this web site. However, I cannot use "getPosition" with CursorAdapter object. I tried ArrayAdapter, but then the line after "Before set arrayadapter" comment errors with "android.widget.SimpleCursorAdapter cannot be cast to android.widget.ArrayAdapter". What am I doing wrong? Thanks.
have you thought about running a for loop until you find the position then set the adapter position that way? ill draft up some code then test it, i'm doing something similar
and well this just did the trick, enjoy!
int cpos = 0;
for(int i = 0; i < simpleCursorAdapter.getCount(); i++){
cursor.moveToPosition(i);
String temp = cursor.getString((your column index, an int));
if ( temp.contentEquals(yourString)){
Log.d("TAG", "Found match");
cpos = i;
break;
}
}
spinner.setSelection(cpos);

AS3 Using a variable with Transform

I have a text field and a background and want to apply color using
myColorPicker. Either the text field or background can be selected using
radioGroup1. When either radio button is selected the trace statement
traces the variable obj2Clr exactly. However when I use that variable
with Transform, I can't apply color. If I hard code and use the actual
object then it works.
Can I not use a variable with Transform or is something else missing?
My code is below:
var radioGroup1:RadioButtonGroup = new RadioButtonGroup("selObj");
bkg_rb.label = "Background";
text_rb.label = "Text";
bkg_rb.group = radioGroup1;
text_rb.group = radioGroup1;
var obj2Clr;//which object to apply color to
radioGroup1.addEventListener(MouseEvent.CLICK, getObj);
function getObj(e:MouseEvent):void {
if (bkg_rb.selected == true) {
obj2Clr = "MovieClip(parent).design_mc.bkg_mc";
trace(obj2Clr);
} else if (text_rb.selected == true) {
obj2Clr = "MovieClip(parent).design_mc.info_txt";
trace(obj2Clr);
}
}
var colorTrans:ColorTransform = new ColorTransform();
var trans:Transform = new Transform(obj2Clr);
//var trans:Transform = new Transform(MovieClip(parent).design_mc.info_txt);
myColorPicker.addEventListener(ColorPickerEvent.CHANGE, changeColor);
function changeColor(event:ColorPickerEvent):void {
var myColor = "0x" + event.target.hexValue;
colorTrans.color = myColor;
trans.colorTransform = colorTrans;
trace("color selected is " + myColor);
}
Thanks for your help in advance:)
Debbie D
According to this code, obj2Clr is being initialized with a string literal?
For example, shouldn't this snippet:
if (bkg_rb.selected == true) {
obj2Clr = "MovieClip(parent).design_mc.bkg_mc";
trace(obj2Clr);
}
be:
if (bkg_rb.selected == true) {
obj2Clr = MovieClip(parent).design_mc.bkg_mc;
trace(obj2Clr);
}
?
Thanks, yes I thought I had to use a string literal with Transform because tracing out the variable without quotes that make it a literal resulted in [object MovieClip] and [object TextField].
So I removed the quotes and Transform still is not receiving the new Transform object. Yet when I hard code (which was commented out in the above example) everything is fine. Any other area I should check?
Debbie D :)

Resources